zmoazeni / csscss

A CSS redundancy analyzer that analyzes redundancy.
http://zmoazeni.github.io/csscss/
MIT License
2.92k stars 151 forks source link

Include SASS files from the cli #81

Closed zamith closed 10 years ago

zamith commented 10 years ago

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?

zmoazeni commented 10 years ago

@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.

zamith commented 10 years ago

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

zmoazeni commented 10 years ago

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

zamith commented 10 years ago

@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?

zmoazeni commented 10 years ago

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

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

zamith commented 10 years ago

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

zmoazeni commented 10 years ago

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