Uses of scss in plugins


(Piotr Szal) #1

Hello,

I have used scss in my plugins. I register only one scss file and import in her all other scss files.
This was working fine.

Link here: #268 Sass Basics - RailsCasts

plugin_folder/plugin.rb

register_asset('stylesheets/expert.css.scss')

plugin_folder/assets/stylesheets/expert.css.scss

/*
 *= require_self
*/

@import "desktop/expert_expansion";
@import "desktop/topic-expert";

Now I’ve update discourse from master and the @import do not work anymore :frowning:

Now I got this:

Sass::SyntaxError - File to import not found or unreadable: desktop/expert_expansion.
Load paths:
/Users/pisz/work/rails/foo/bar/app/assets/stylesheets

The load paths dont contains paths from the plugin.

(Now I have to register all files separate :frowning: )


(Benjamin Kampmann) #2

This is a regression introduced by the new scss-importing mechanism merged as PR 2244, 18h ago, which changed the import behaviour for plugins stylesheets from require-based-imports into a big concatenated file, which means losing the import-path-context for the scss engine.

This pull-request fixes this by created an intermediate scss-file of @import-statements instead, which allows the Sass::Engine to still keep and understand the context of the file and find relative imports:

https://github.com/discourse/discourse/pull/2250


(Sam Saffron) #3