Financial-Times / o-grid

Responsive grid system
http://registry.origami.ft.com/components/o-grid
94 stars 17 forks source link

Bower path #3

Closed wheresrhys closed 10 years ago

wheresrhys commented 10 years ago

I've been assuming that we would use a sass include-path to specify the location of bower_components, so it should be bad practice, imho, to hard code paths into modules that assume the location of bower_components in a project that they might be included in. Instead, the import ought to be:

@import 'grid-module/main'  

And then the product's (or build service's) build process can resolve the correct path to bower in its particular case (which in all probability is ../bower_components, but we shouldn't assume that) @triblondon

wheresrhys commented 10 years ago

I'm not 100% sure I follow, and I searched the sass docs but can't find anything about a sass include-path. Does this relate to how grid-module is likely to be shared by numerous modules within a product and the product itself and we only want to include it once in the built styles?

triblondon commented 10 years ago

Yes. So in your product you include grid by doing:

@import 'grid-module/main'

And in your build process you run your sass compiler with an --include-path set to ./bower_components (assuming you run it from the root of your project). Here's the usage guide for node-sass showing that option:

Andrews-MacBook-Air:grid-module andrew$ node-sass
Compile .scss files with node-sass
Usage: node-sass [options] <input.scss> [<output.css>]

Options:
  --output-style     CSS output style (nested|expanded|compact|compressed)  [default: "nested"]
  --source-comments  Include debug info in output (none|normal|map)         [default: "none"]
  --include-path     Path to look for @import-ed files                      [default: "/Users/andrew/sandboxes/grid-module"]
  --help, -h         Print usage info                                     
wheresrhys commented 10 years ago

I'll update grid-module... but is this mentioned at all in origami docs? Seems like it should be

triblondon commented 10 years ago

It should be on this page I think: http://financial-times.github.io/ft-origami/docs/syntax/scss/.

I'll add something there.