【如何将style.sass编译为style.css并保持缩进】我正在与webpack开创一个Wordpress主题。我想将sass文件编译为css文件。
目标是将style.sass编译为style.css, 而无需最小化并保留标准注释标头。
webpack.config.js
const path = require('path');
// include the css extraction and minification plugins
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
//const OptimizeCSSAssetsPlugin = require("optimize-css-assets-webpack-plugin");
module.exports = {
entry: './dev/my-theme/style.sass', output: {
path: path.resolve(__dirname, 'dist/'), }, module: {
rules: [
// compile all .scss files to plain old css
{
test: /style.sass$/, use: [MiniCssExtractPlugin.loader, 'css-loader', 'sass-loader']
}
]
}, plugins: [
// extract css into dedicated file
new MiniCssExtractPlugin({
filename: './my-theme/style.css'
})
]/*, optimization: {
minimizer: [
// enable the css minification plugin
new OptimizeCSSAssetsPlugin({})
]
}*/
};
风格
/*!
/*! Theme Name: My Theme
/*! Author: Robinson
/*! Author URI: https://robinson.org
/*!
style.css
/*! *//*! Theme Name: My Theme *//*! Author: Robinson *//*! Author URI: https://robinson.org *//*! */
代替…
/*
Theme Name: My Theme
Author: Robinson
Author URI: https://robinson.org
*/
我怎样才能做到这一点 ?
#1我发现的最好方法是像这样修改style.sass:
/*!
Theme Name: My Theme
Author: Robinson
Author URI: https://robinson.org
推荐阅读
- 如何配置WordPress开发,主要,次要更新配置
- CentOS 8 - Bind DNS -支持IPV4&IPV6双栈服务配置
- ARHEL 6 中误删 libc.so.6 文件后恢复
- linux之lscpu命令
- oeasy教您玩转vim - 46 - # 范围控制
- 编译安装基于FASTCGI模式LAMP架构多虚拟主机WEB应用及loganalyzer图形化日志
- Redis备份工具Redis-dump
- Zabbix Fping 存活检测
- linux之sshpass命令