Support multiple source paths
jpettersson opened this issue · 5 comments
This is a feature that Sprockets have, but that I decided to not port when starting the project. Since then there has been some discussions, for instance in #41 . Should we add this as a planned feature for 2.0.0?
The interface could be something like this:
var lingon = require('lingon');
// lingon.sourcePaths is an array
// lingon.sourcePath still exists and will be used if the array is empty
// To add a new path
lingon.sourcePaths.push("/some/path");
The arguments for this feature are:
- Easily include files that are outside of the source folder
- Allow other programs to register local paths for embedded assets (installing the jquery gem allows you to include "jquery" in Sprockets)
Arguments against:
- Adds complexity. Multiple paths are not vital for the functionality and can create some confusion.
I might come up with more pros/cons later. What do you say>?
I actually like the simplicity we have currently and if you use symlinks you can achieve similar behavior. Then again Symlinks are more tricky on non-Unix systems and to be honest I never tried running lingon on a Windows machine ;)
Did we decide on where we position lingon on the complexity scale, compared to middleman? I remember using middleman way back when I was a n0o00o0o00b and had no problems using it cause it was so simple, and I had no clue how it worked. Symlinks of course aren't complex but I would've been confused back then if I'd had to do custom "hacks" like that.
Personally I think its fine to primarily target experienced devs with lingon, i.e. we don't need to support every little use case that's achievable through standard non-lingon means, like symlinks. We could of course include it in docs tho
And for windows..................... nahhhhhhhhhhhhhhhhhh :)
I think multiple source paths are a useful addition but not necessarily something that needs to be added straight away (post 2.0.0 perhaps?).
I currently use a Sprockets-based static site generator called Machined (https://github.com/petebrowne/machined) and I find the app/lib/vendor assets directories gives you a nice convention-based approach to organising those different classes of assets.
Symlinks provide an adequate alternative for now (even as one of those elusive Windows users) but ultimately I think having multiple source paths supported natively in Lingon would be useful.
@Coridyn thanks for your input! I've not seen machined before, looks like another project to take inspiration from for Lingon.
I think the arguments are in favor for multiple source paths, the benefits outweigh the complexity added to the codebase. Let's try and get it in for 2.0.0 since we are changing a lot in core anyway. I'm moving this issue to the milestone.