Sass

8. webpack css 打包(css-loader style-loader sass-loader)

丶灬走出姿态 提交于 2020-02-05 03:52:43
文章目录 css-loader style-loader sass-loader webpack.config.js 配置css 模块 引入背景图片或者字体文件库,需要引入 file-loader 或者 url-loader css-loader css-loader 解析 CSS 文件后,使用 import 加载,并且返回 CSS 代码 npm install --save-dev css-loader 参数说明 css-loader github style-loader style-loader 将模块的导出作为样式添加到 DOM 中 npm install style-loader --save-dev 参数说明 style-loader github sass-loader sass-loader 加载和转译 SASS/SCSS 文件,将SCSS 文件转为CSS文件 npm install sass-loader node-sass webpack --save-dev 参数说明 sass-laoder github webpack.config.js 配置css 模块 const path = require ( "path" ) ; const { CleanWebpackPlugin } = require ( "clean-webpack-plugin" ) ;

vue错误:Module build failed: Error: Cannot find module 'node-sass'

丶灬走出姿态 提交于 2020-02-05 00:07:04
vue错误: ERROR Failed to compile with 2 errors 20 : 19 : 24 error in . / src / views / Main . vue Module build failed : Error : Cannot find module 'node-sass' Require stack : - D : \Vue\workspace\hellovue\node_modules\sass - loader\dist\index . js - D : \Vue\workspace\hellovue\node_modules\sass - loader\dist\cjs . js - D : \Vue\workspace\hellovue\node_modules\loader - runner\lib\loadLoader . js - D : \Vue\workspace\hellovue\node_modules\loader - runner\lib\LoaderRunner . js - D : \Vue\workspace\hellovue\node_modules\webpack\lib\NormalModule . js - D : \Vue\workspace\hellovue\node_modules\webpack

How to import a scss file inside a scss class

梦想的初衷 提交于 2020-02-04 00:46:25
问题 I want to add a different theme when i add "dark-theme" class to body. My implementation looks like this: @import '../../../../node_modules/angular-grids/styles/material.scss'; .app-dark { @import '../../../../node_modules/angular-grids/styles/material-dark.scss'; } Without any luck. Any clue on how to do this? 回答1: There are two methods in order to do that. Both of them include mixins. meta.load-css The sass:meta feature gives the ability to do what you want. Say you have this scss file with

hbuilder中如何使用sass

天大地大妈咪最大 提交于 2020-02-03 20:00:32
安装scss/sass编译插件 如果本地安装了nodejs,版本不一样可能会出错。 工具 -> 插件安装 -> scss/sass编译插件 1405576-20190404093045162-498834772.png 将sass编译成css 新建scss文件,编写完成后,(右键scss文件 -> 外部命令/插件 -> sass -> 编译scss/sass),即可编译成功,默认与当前scss文件同级 修改配置文件,实现保存即编译,将编译后的文件放到自定义目录 工具 -> 插件配置 -> compile-node-sass -> package.json 1405576-20190404093912557-2012630255.png 转载于:https://www.cnblogs.com/Yancyzheng/p/10653114.html 来源: CSDN 作者: 爱吃柠檬的亮亮 链接: https://blog.csdn.net/dyl549861114/article/details/104159546

How to force webpack to put the plain CSS code into HTML head's style tag?

耗尽温柔 提交于 2020-02-03 10:18:14
问题 I have this webpack.config : const UglifyJsPlugin = require("uglifyjs-webpack-plugin"); const HtmlWebpackPlugin = require('html-webpack-plugin'); const HtmlWebpackInlineStylePlugin = require('html-webpack-inline-style-plugin'); const path = require('path'); module.exports = { mode: 'production', entry: { main: [ './src/scss/main.scss' ] }, output: { path: path.resolve(__dirname, './dist'), publicPath: '', filename: 'js/[name].js' }, optimization: { minimizer: [ new UglifyJsPlugin({ cache:

解决npm安装node-sass太慢及编译错误问题

拟墨画扇 提交于 2020-02-03 09:20:49
环境: win7 node v8.11.1 npm v5.6.0 背景: 最近vue项目使用sass,所以需要sass-loader,sass-loader依赖node-sass,还需安装node-sass,但是安装node-sass又太慢了。 解决: 切换国内镜像 $ npm install -g mirror-config-china --registry=http://registry.npm.taobao.org 安装sass-loader、node-sass(-D 是 --save-dev 的简写) $ npm install sass-loader node-sass -D 切换为国内镜像后,安装只需少量时间 然后启动项目 $ npm run dev 总是报错, Modele build failed: TypeError: this.getResolve is not a function at Object.loader... 安装的sass-loader的版本为最新8.0.0,查看网上资料说是版本过高导致编译错误。 我把项目package.json文件中sass-loader版本改为7.3.1 执行命令,重新安装项目依赖 $ npm install 然后,启动项目 $ npm run dev 项目启动成功,编译报错问题解决 转载自: https://www

Is it possible to test for the current element type from within a SASS mixin?

天涯浪子 提交于 2020-02-03 08:52:28
问题 I have a mixin that draws a button like this: @mixin button { border: 1px solid $orange; background: $orange; padding:0; height:27px; text-transform: uppercase; color:white; display:block; // if I'm styling an a tag padding-top:10px 10px 0 10px; } I want to be able to do this: button.my_button { @include button; } a.my_button { @include button; } The second one requires some additional custom code to work nicely. Is is possible to include a conditional in the mixin that checks to see if I'm

Is it possible to test for the current element type from within a SASS mixin?

梦想与她 提交于 2020-02-03 08:52:07
问题 I have a mixin that draws a button like this: @mixin button { border: 1px solid $orange; background: $orange; padding:0; height:27px; text-transform: uppercase; color:white; display:block; // if I'm styling an a tag padding-top:10px 10px 0 10px; } I want to be able to do this: button.my_button { @include button; } a.my_button { @include button; } The second one requires some additional custom code to work nicely. Is is possible to include a conditional in the mixin that checks to see if I'm

How to change image on panel when doing mouseover using CSS - ExtJs?

久未见 提交于 2020-02-03 08:45:06
问题 I'm trying to change images when doing mouseover/mouseleave using CSS or SASS. However, to acomplish this I can always do: header = panel.getHeader().getEl(); and then do this: //mouse enter event header.on('mouseover', function (e) { ....... ....... }, me); //mouseleave event header.on('mouseleave', function (e) { ........ }, me); However, I'm trying to accomplish the same functionality using CSS or SASS . Basically: a) All images should be displayed by default when loading the accordion. (