SASS and Liferay - how to use in custom themes?

試著忘記壹切 提交于 2019-12-03 15:48:33

I found the solution. Key is to understand that Liferay does not use the file extension *.scss on a theme's stylesheets. Just dropping my SASS code into a *.css file did the job!

Found the solution here.

My directory layout:

<theme>
  +-src
     +-main
        +-webapp
           +-css
              +-main.css
              +-custom.css

main.css looks like:

@import url(custom.css);

/* other css import here */

and custom.css like this:

$color: #f00;
body {
    color: $color;
}

And the result is (in custom.css, after reloading on the web browser):

body {
    color: #f00;
}

Hooray!

Yes, if you are working in Liferay 6.2 file extension should be .css, but if you are working in Liferay 7/DXP it should be .scss.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!