【问题标题】:Order of sass files loaded using webpack使用 webpack 加载的 sass 文件的顺序
【发布时间】:2017-07-01 00:53:36
【问题描述】:

目录结构

->src
  ->sass
    ->home.scss 
    ->about.scss 
    ->main.scss
  ->js
    ->home.js
    ->about.js
    ->index.js
->index.php
->package.json
->webpack.config.js

index.js

import '../sass/main.scss';

home.js

import './index';
import '../sass/home.scss';

console.log('this is home');

当我运行 webpack 时,入口点是 home.js,所以它会创建 home.styles.css。在该文件中,home.scss 中的代码在 main.scss 之前连接,而它应该是相反的。

像这样: home.styles.css

/* content of home.scss */
/* content of main.scss */

我希望首先连接 main.scss。我能做什么?

【问题讨论】:

    标签: javascript webpack sass


    【解决方案1】:

    使用@import 控制 sass 文件顺序的功能似乎已被弃用。您可以尝试使用早期版本的 sass,或者看看是否有更多替代方案here

    【讨论】:

      猜你喜欢
      • 2019-07-18
      • 2017-02-19
      • 2019-07-28
      • 2017-01-26
      • 2015-12-18
      • 2016-06-15
      • 2017-11-06
      • 2016-11-20
      • 2019-01-07
      相关资源
      最近更新 更多