dstroot / skeleton

Node Express MongoDB Bootstrap Passport... all rolled up into juicy goodness
skeleton-app.jit.su
MIT License
370 stars 47 forks source link

Per view js / less compilation #34

Closed kungfoolabs closed 9 years ago

kungfoolabs commented 9 years ago

Great project and awesome for getting started. One thing that is that currently missing the per view js and css compilation. Looking at drywall, this was something that was present and made it easy to have backbone, for example. integrated only on some of the pages. Not sure the recommended way, but I am looking into using browserify.

dstroot commented 9 years ago

Actually the project does have per page less/css. If you create a page specific less file in /less such as `colors-api.less' it will be compiled and minified separately. Then include the page specific css in the jade template like so:

extends ../layouts/layout

block head
  title #{application} · Colors

block styles
  link(rel='stylesheet', href='/css/page-colors.min.css')

...

I think it also makes sense to have per view specific js but since just about everything is done via libraries anyway I did not build it out - I just reference the .js file via a script tag.

kungfoolabs commented 9 years ago

Thanks Dan. That makes sense. I am trying to get the client side js to conform to the CommonJS standard by using browserify. Will definitely send a change request if/when I get it figured out.

dstroot commented 9 years ago

Great - definitely send a PR.

Side note - why Browserify instead of Webpack? ​

On Sun, Feb 1, 2015 at 11:19 PM, kungfoolabs notifications@github.com wrote:

Thanks Dan. That makes sense. I am trying to get the client side js to conform to the CommonJS standard by using browserify. Will definitely send a change request if/when I get it figured out.

— Reply to this email directly or view it on GitHub https://github.com/dstroot/skeleton/issues/34#issuecomment-72415245.

kungfoolabs commented 9 years ago

LOL. Because i didn't know about Webpack. Will check it out.