2

For my app I'm using browserify to deal with javascript, and it is indeed awesome. I can modularize, transpile coffeescript, bundle, preinitialize minification with ngmin, minify, add source maps etc.

I even was able to bundle all my html templates into one single javascript file using gulp-angular-templatecache

Now, I still need to find the best way to handle style files. (I'm using Stylus)

I've figured I can use insert-css and stylify, but I don't like the idea of injecting styles into javascript. They should be called from related html file, isn't that right?

Is there an easy way to grab all styles from html templates, resolve dependencies (some styles may be importing others) and correctly bundle them

into single or separate files, let's say if for some reason I'd like to bundle third-party styles - like bootstrap css separately.

If I find a nice way to do that, I can turn angular directives into truly reusable components - everything related to a directive would be contained in one folder (javascript, html, css)

iLemming
  • 34,477
  • 60
  • 195
  • 309
  • I think you will find this help full [Angular Best Practives](http://stackoverflow.com/q/20802798/1959948) – Dalorzo May 21 '14 at 20:29
  • I checked github repo it's pointing to, where's not much about css, except that file structure they suggesting to use is similar to what I want and css, html and javascript related to a directive all sitting in the same folder. Still doesn't say how to use that style files. You can call those .css from your template, that would work, but then css has to be fetched from server everytime. And I'd like to avoid that – iLemming May 21 '14 at 20:37
  • 1
    Have a look at [atomic design](http://bradfrostweb.com/blog/post/atomic-web-design/). Just as a suggestion. – Dominik Jun 10 '14 at 02:33

0 Answers0