1

这是我的超级简单的 scss 文件:

html {
  body {
    font-size: 100%;
    background: url(../img/repeater.jpg);
  }
}

我以这种方式将它导入到我的 App.jsx 文件中:import "./App.scss";

这是我的模块中的内容:加载器:

            // SASS
            {
                test: /\.scss$/,
                include: /shared/,
                loaders: [
                    'style',
                    'css',
                    'autoprefixer?browsers=last 3 versions',
                    'sass?outputStyle=expanded'
                ]
            }

但是,我在控制台中得到了这个,而不是发生了令人敬畏的事情:

SyntaxError: /Users/jasonshultz/Projects/work/gradebook/shared/containers/App/App.scss: Unexpected token (1:5)
> 1 | html {
    |      ^
  2 |   body {
  3 |     font-size: 100%;
  4 |     background: url(../img/repeater.jpg);
    at Parser.pp.raise (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1425:13)
    at Parser.pp.unexpected (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2907:8)
    at Parser.pp.semicolon (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2894:38)
    at Parser.pp.parseExpressionStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2264:8)
    at Parser.parseExpressionStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:3596:20)
    at Parser.pp.parseStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1955:17)
    at Parser.parseStatement (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:3574:22)
    at Parser.pp.parseBlockBody (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:2294:21)
    at Parser.pp.parseTopLevel (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1823:8)
    at Parser.parse (/Users/jasonshultz/Projects/work/gradebook/node_modules/babel-core/node_modules/babylon/index.js:1396:17)

这是非常令人敬畏的。如果有帮助,将代码放在 github 上。到目前为止,我还没有任何运气让它发挥作用。我尝试过不同的风格,等等,但一无所获。

4

0 回答 0