2017-07-11 57 views
1

我在https://github.com/joostvanrijn/webpacker創建了一個示例應用程序是完整的,但這裏是我的問題:Webpacker使用Rails編譯SCSS諧音

# app/javascript/packs/stylesheets.scss 

@import 'variables'; 
@import 'foo'; 

# app/javascript/packs/_variables.scss 

$bar: #fff; 

# app/javascript/packs/_foo.scss 

body { 
    color: $bar; 
} 

現在,當我運行/bin/webpack-dev-server我得到

Undefined variable: "$bar". 

而且更重要的是

[84] ./app/javascript/packs/_foo.scss 988 bytes {2} [built] [failed] [1 error] 

好像Rails/webpacker編譯所有文件而不是ju st​​

回答

2

我已經能夠最終找到答案。

從Webpacker自述:

The configuration for what Webpack is supposed to compile by default 
rests on the convention that every file in app/javascript/packs/* 
(default) or whatever path you set for source_entry_path in the 
webpacker.yml configuration is turned into their own output files (or 
entry points, as Webpack calls it). 

所以通過移動SASS泛音到另一個文件夾現在只有stylesheets.scss被編譯。