Coder Social home page Coder Social logo

Avoid name collisions about gulp-dust HOT 9 CLOSED

sindresorhus avatar sindresorhus commented on June 15, 2024
Avoid name collisions

from gulp-dust.

Comments (9)

sindresorhus avatar sindresorhus commented on June 15, 2024

What do you think about doing the same as gulp-nunjucks and making the default name the relative path (eg. templates/articles/show) and adding an option for specifying a name using a callback function?

See: https://github.com/sindresorhus/gulp-nunjucks#nunjucksoptions

from gulp-dust.

b00gizm avatar b00gizm commented on June 15, 2024

Sounds good for me :) 👍

from gulp-dust.

b00gizm avatar b00gizm commented on June 15, 2024

Are you planning to integrate this anytime soon? :)
It would be really helpful for my current projects.

from gulp-dust.

sindresorhus avatar sindresorhus commented on June 15, 2024

@b00gizm done.

Can you try out master and let me know if it works for your use-case?

npm install git://github.com/sindresorhus/gulp-dust

from gulp-dust.

b00gizm avatar b00gizm commented on June 15, 2024

@sindresorhus

This is weird: When I define a custom callback function for the name (in my case, I want to omit the file extension, i.e. path/to/foo), it'll just be applied on the very first file that comes through. All following files are ignored and registered with your default schema (path/to/bar.dust).

from gulp-dust.

sindresorhus avatar sindresorhus commented on June 15, 2024

@b00gizm can you share your callback function?

from gulp-dust.

b00gizm avatar b00gizm commented on June 15, 2024

@sindresorhus

I already found it.

name = typeof name === 'function' && name(file) || file.relative;

This works for the first file that comes through, but for all following ones, name will always be a string, so typeof name === 'function' will fail and we're returning the fallback.

Just use something other than name for the assignment ;)

Sorry, I wanted to send you a pull request, but writing a test for this is a real pain.

from gulp-dust.

sindresorhus avatar sindresorhus commented on June 15, 2024

@b00gizm oops, you're right. should be fixed now. check master.

from gulp-dust.

b00gizm avatar b00gizm commented on June 15, 2024

Yep, that's it. Thank you :)

from gulp-dust.

Related Issues (9)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.