zmoazeni/csscss

Include SASS files from the cli

Closed this issue · 7 comments

I often have separate files for mixins and variables which are them put together by rails asset pipeline, so there are files that use these variables, but do not include the file with the definitions.

It would be nice to be able to include them from the cli. Is this possible?

@zamith I'm not sure offhand. But I know that goes against rails/sass convention

If you want to use multiple Sass files, you should generally use the Sass @import rule instead of these Sprockets directives. Using Sprockets directives all Sass files exist within their own scope, making variables or mixins only available within the document they were defined in.

@zmoazeni What about having a single sass file with all the imports?

@zamith That should work already. Is that not working for you now?

@zmoazeni It does not work because I'm using foundation-rails, for which I don't have the source files. But that I think I can work around.

The problem for me is when I want to check just one file, then I want to specify it's dependencies, which are not imported in said file. I wrote a very dumb patch that does want I want and the syntax is this: csscss --ignore-sass-mixins --require-sass _mixins.sass,_foundation_and_overrides.sass _components.sass

I want to check the _components.sass partial, but need variables and mixins in the other files.

Is this an edge case? Am I doing anything wrong here?

@zamith Have you seen the --require flag? csscss --require foo.rb

Not sure if that can prep what you're looking for or not.

@zmoazeni I've tried that, but it only allows to require ruby files, I want to require other sass files.

@zamith Can you put together a small rails codebase on github that illustrates the issue?