karthikv / nodefront

A node.js-powered rapid front-end development utility.
http://karthikv.github.com/nodefront
MIT License
246 stars 11 forks source link

option to exclude files from compile #26

Open notslang opened 12 years ago

notslang commented 12 years ago

It would be very useful to be able to exclude files from compiling because, in my current project, I have many files that are only part of a layout (much like what is described in issue #24) and cannot be compiled on their own.

Excluding files could probably be done with a white-list given as a parameter of the nodefront command. Like: nodefront compile -w index.jade or for multiple files nodefront compile -w index.jade script.coffee somefolder/anotherscript.coffee... and if no files are specified then nodefront would compile the entire directory like it normally does.

Also, this white listing functionality could be expanded by allowing regular expressions (like those used in the minify command to determine what files should be minified) to determine what files should be compiled.

This same parameter could also be used in the serve command, which would then just be passed on to the compile command that serve calls.

I think that a white-list would suffice for most projects, including my current one, for which I only need to compile a few files. Maybe a black-list could be added if use-cases are found that require it.

notslang commented 12 years ago

For being used in the serve command, I think that this would conflict with the way that port numbers are passed, so the syntax should be changed to use -p or --port to specify the port number, like this: nodefront serve -p 5000 index.jade

olliebennett commented 11 years ago

My only suggestion for implementing a blacklist would be to exclude the node_modules folder, for those of us who prefer not to install nodefront (and other modules) globally.

To comment on your whitelist suggestion, the -w flag means --watch, so we'd need to reconsider that choice.

ForbesLindesay commented 11 years ago

I think we could safely add node_modules as an implicit blacklist that's enforced whether you like it or not.

"grep" is the word you're looking for as far as specifying a white-list goes.

If we're going to use the word "grep" we should use minimatch to give it unix like filtering semantics. One of the nice things is that this automatically supports whitelists or blacklists because a blacklist just looks like !foo where the whitelist looks like foo.