linemanjs / lineman

Lineman helps you build fat-client JavaScript apps. It produces happiness by building assets, mocking servers, running specs on every file change
MIT License
1.18k stars 83 forks source link

Changing generated and dist folders #317

Closed Foxandxss closed 9 years ago

Foxandxss commented 9 years ago

Hey, so I was wondering, now trying to use Lineman with Laravel.

Even when I know the main purpose of 1st class apps, I was going to try to use lineman as an assets preprocessor instead of well, a fully complete workflow tool.

Normally I put a frontend folder on my backend where I put Lineman. I was wondering on generating directly the stuff into laravel's /public instead of generated folder. That would simplify some things for me.

The thing is that both generated and dist are hardcoded in a bunch of places. Isn't that inflexible? I know Lineman is opinionated (in a certain degree) but well, I would need to rewrite a lot of tasks to change the hardcoded paths. WDYT? Maybe I am trying to use the tool wrong in this case.

searls commented 9 years ago

Short answer: I would recommend you use symlinks for now.

Longer answer: your comment that we have generated/dist hardcoded everywhere intrigued me, because I hadn't really thought of it much. A long time ago @jasonkarns submitted a PR to unwind that, but it had the unintended consequence of creating a bunch of extra indirection in all the file globs

By my count we have 19 uses of "generated" in the built-in files.js configuration, one hard-coding in the server task, one in the clean task, two in spec.json, two in the copy task, one in the images task, and one in the webfonts task.

That sounds like a lot of work to undo. My hope is that in your case you'd be able to get the outcome you want by either symlinking to generated/ or symlinking from generated/ to your desired destination instead of having lineman write out to a different directory (which would require you script that link's recreation on clean instead of mkdirp)

jasonkarns commented 9 years ago

There's another option which myself and @theotherzach have used in the past. Instead of altering any of lineman's configuration, you could add a copy task at the very end to copy the contents of /generated into /public (or wherever).

Side note, are you sure you want to use /generated and not /dist? The generated directory also includes quite a few temp files (like compiled coffeescript/less/sass prior to concatenation/minification) that could confuse Laravel.

Foxandxss commented 9 years ago

Oh, you're right. It is much much easier to just move folders than trying to do the entire serie of tasks into a new folder.

Thanks :)