Dear core team,
I have a scenario that I think is important for developing apps with
DRY, modular CSS, and I can't figure out how to make it work with the
asset pipeline. I hope this provides useful feedback on what I think
is a shortcoming in the pipeline design.
The simplified scenario: I have a common.scss, with SCSS shared by
multiple applications. However, I'd like to override some variables in
common.scss in each application. For example, I have a $color variable
that sets the general hue of the application, and all the colors used
are computed based on that variable. I put all those variables in a
_vars.scss partial that is @imported by common.scss. An application
also has its' own SCSS, in special.scss. The application-specific SCSS
also uses the variables in _vars.scss, to keep things DRY.
In Rails 3.0, I had a generator that copied the following structure to
/public/stylesheets:
/common/_vars.scss
/common/common.scss -- @imports _vars.scss
/special.scss -- @imports _vars.scss
For Rails 3.1, I would like to keep common.scss in /app/assets in an
engine gem, and generate _vars.scss inside the application. However,
I'm not sure what's the best place to put _vars.scss, and how to get
it @imported in common.scss. I don't think _vars.scss belongs in
/app/assets, because I don't want the //= require_tree to pick it up,
but I really don't know where it should go, or what API I should use
to compute its path.
DHH said, in his keynote, that he's been using the pipeline mostly for
JavaScript. SCSS is different, because a compiled .scss doesn't have
all the information in the original file -- the .css output doesn't
have mixin and variable information. Maybe we need a helper for
@importing?
Thank you for your help in advance,
Victor
--
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Core" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/rubyonrails-core?hl=en.