Persisting SCSS variables in rails asset pipeline?

前端 未结 4 777
被撕碎了的回忆
被撕碎了的回忆 2021-01-01 14:56

I\'m upgrading a rails app with lots of SCSS stylesheets to use the asset pipeline, and need to include some global variables and mixins for each file.

Adding severa

4条回答
  •  臣服心动
    2021-01-01 15:33

    Simply importing the necessary file from each Scss or Sass file seems to have worked for me. For example, I have a colors.scss file that includes some constants like this:

    $black: #222;
    

    I require it in my application.css manifest along with some other files:

    /*
     *= require colors
     *= require buttons
    */
    

    In my buttons.css.scss file, I simply do this to avoid the error:

    @import "colors";
    

提交回复
热议问题