Added option for output directory #2

wants to merge 2 commits into


None yet
3 participants

Acconut commented Jan 7, 2014

This adds an options to change the path the compiled files are written to and are served from. The path from which is read is still the same as before.
It's useful if you don't want to mess your directory with asset-*-files up and also want to prohibit that your original files are served.

var assets = ferguson('./assets', {
    outputDir: './compiled'

The manifest-file still remains in the read directory.

This pull request isn't finished yet, I want to add tests to it (but I'm not sure how to deal with that) and there's a bug where old compiled files aren't cleaned up. I don't know if this comes from my changes.


jbergstroem commented Jan 20, 2014

Design-wise, we went for your web server to limit access to originals over customising output directory since it raises other problems. Also, cleaning up is somewhat outside of the scope; a cron job would be more suitable for this.


chriso commented Jan 20, 2014

As discussed in the README, we write compiled assets to the same directory so that all assets, including ones that don't need to be compiled, such as favicon's, can be served with nginx's try_files or similar. I'd rather see a whitelist or blacklist option which could be used to limit the assets that are served. Of course you could do this in the layer above node but it would be nice to say options.blacklist = ['.less'];.

@jbergstroem the library is responsible for, and should be, cleaning up stale compiled assets.

Acconut commented Jan 25, 2014

@chriso You mean blacklisted file's won't be served to the public?
Would be another option, yes.


jbergstroem commented Feb 23, 2015

Closing since this isn't really the scope of ferguson (and somewhat out of date).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment