npm install sass-loader node-sass --save-dev
<style lang="sass"> /* 这里写一些 sass 代码 */ </style>
npm install coffee-loader --save-dev
<script lang="coffee"> # 这里写一些 coffeescript! </script>
npm install jade --save-dev
<template lang="jade"> div h1 Hello world! </template>
<style lang="sass?outputStyle=expanded"> /* use sass here with expanded output */ </style>
<img src="../image.png">
createElement('img', { attrs: { src: require('../image.png') }})
// webpack.config.js
module.exports = {
// other options...
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
}
]
},
// vue-loader 配置
vue: {
// ... 其他 vue 选项
loaders: {
// 用 coffee-loader 加载所有没有 "lang" 属性的 <script>
js: 'coffee',
// 直接把 <template> 作为 HTML 字符串来加载,不需先用 vue-html-loader 处理。
html: 'raw'
}
}
}
module.exports = {
// 其他选项...
module: {
// module.rules 是和版本1.x中的 module.loaders 是相同的
rules: [
{
test: /\.vue$/,
loader: 'vue',
// vue-loader 选项在这里配置
options: {
loaders: {
// ...
}
}
}
]
}
}
npm install extract-text-webpack-plugin --save-dev
// webpack.config.js
var ExtractTextPlugin = require("extract-text-webpack-plugin")
module.exports = {
// other options...
module: {
loaders: [
{
test: /\.vue$/,
loader: 'vue'
},
]
},
vue: {
loaders: {
css: ExtractTextPlugin.extract("css"),
// 你也能包含 <style lang="less"> 或其他语言
less: ExtractTextPlugin.extract("css!less")
}
},
plugins: [
new ExtractTextPlugin("style.css")
]
}
npm install extract-text-webpack-plugin@2.x --save-dev
// webpack.config.js
var ExtractTextPlugin = require("extract-text-webpack-plugin")
module.exports = {
// 其他选项...
module: {
rules: [
{
test: /\.vue$/,
loader: 'vue',
options: {
loaders: {
css: ExtractTextPlugin.extract({
loader: 'css-loader',
fallbackLoader: 'vue-style-loader' // <- this is a dep of vue-loader, so no need to explicitly install if using npm3
})
}
}
}
]
},
plugins: [
new ExtractTextPlugin("style.css")
]
}
机械节能产品生产企业官网模板...
大气智能家居家具装修装饰类企业通用网站模板...
礼品公司网站模板
宽屏简约大气婚纱摄影影楼模板...
蓝白WAP手机综合医院类整站源码(独立后台)...苏ICP备2024110244号-2 苏公网安备32050702011978号 增值电信业务经营许可证编号:苏B2-20251499 | Copyright 2018 - 2025 源码网商城 (www.ymwmall.com) 版权所有