vendredi 10 juin 2016

rails - creating a folder under stylesheets


Under my app/assets/stylesheets I created a folder components because I like to create styles specific to each one of my html components. This way in my actual sass file (some_page.scss) I can just do a few imports depending on what I need.

for a visual, here's what the folder structure looks like now:

- app
  - assets
    - stylesheets
      - components
        _component1.scss
        _component2.scss
      application.css
      page-specific.scss

right now under components I have

_colors.scss // declaring colors for my app
_other_stuff.scss // other stuff...

usually when doing imports, I import colors first so that I can use them in the rest of my components. But rails is complaining:

Showing /Users/abdulahmad/Desktop/rails/password-service/app/views/layouts/application.html.erb where line #5 raised:

Undefined variable: "$green".

am I supposed to do something special to tell rails that I want my sass compiled in the components folder? or is this error being thrown for another reason?

by the way, here are the contents of my page-specific scss file:

@import 'components/colors';
@import 'components/inputs';

Aucun commentaire:

Enregistrer un commentaire