Yeoman中处理Sass文件的工作流是什么?
我尝试使用yeoman,但我不知道如何使用我自己的sass文件 与Yeoman中处理Sass文件的工作流是什么?,sass,compass-sass,gruntjs,yeoman,Sass,Compass Sass,Gruntjs,Yeoman,我尝试使用yeoman,但我不知道如何使用我自己的sass文件 与 grunt服务器 Sass文件被监视并编译为 .tmp/styles/ 但是除了 那么,在开发过程中使用index.html中编译的sass文件的推荐方法是什么 例如,grunt服务器,如果我将我的styleapp/styles/my.sass更改为.tmp/styles/my.css,这将被覆盖,并且它位于服务器外部(localhost:9000)。因此,不可能在index.html中链接它 使用grunt build是mai
grunt服务器
Sass文件被监视并编译为
.tmp/styles/
但是除了
那么,在开发过程中使用index.html中编译的sass文件的推荐方法是什么
例如,grunt服务器
,如果我将我的styleapp/styles/my.sass
更改为.tmp/styles/my.css
,这将被覆盖,并且它位于服务器外部(localhost:9000)。因此,不可能在index.html
中链接它
使用grunt build
是main.css
中的所有内容,包括my.sass
,但是在开发过程中,我不知道如何在index.html
中使用我自己的sass文件
你能给我举个简单的例子吗
这是默认安装。我这样做:
yo角度测试
app/style/style.sass
grunt服务器
将style.sass
编译成.tmp/style/style.css
style.css
it“严格使用”;
var lrnippet=require('grunt-contrib-livereload/lib/utils')。livereloadSnippet;
var mountFolder=函数(连接,目录){
返回connect.static(require('path').resolve(dir));
};
module.exports=函数(grunt){
//加载所有grunt任务
require('matchdep').filterDev('grunt-*').forEach(grunt.loadNpmTasks);
//可配置路径
var yeomanConfig={
应用程序:“应用程序”,
dist:“dist”
};
试一试{
yeomanConfig.app=require('./component.json').appPath | | yeomanConfig.app;
}捕获(e){}
grunt.initConfig({
约曼:约曼图,
观察:{
咖啡:{
文件:['/scripts/{,*/}*.coffee'],
任务:['coffee:dist']
},
咖啡测试:{
文件:['test/spec/{,*/}*.coffee'],
任务:[“咖啡:测试”]
},
指南针:{
文件:['/styles/{,*/}*{scss,sass}'],
任务:[“指南针”]
},
利弗雷罗德:{
档案:[
'/{,*/}*.html',
“{.tmp,}/styles/{,*/}*.css”,
“{.tmp,}/scripts/{,*/}*.js”,
“/images/{,*/}*{png,jpg,jpeg,gif,webp}”
],
任务:['livereload']
}
},
连接:{
利弗雷罗德:{
选项:{
港口:9000,
//将此更改为“0.0.0.0”以从外部访问服务器。
主机名:“localhost”,
中间件:功能(连接){
返回[
小片段,
mountFolder(连接“.tmp”),
mountFolder(连接,yeomanConfig.app)
];
}
}
},
测试:{
选项:{
港口:9000,
中间件:功能(连接){
返回[
mountFolder(连接“.tmp”),
安装文件夹(连接“测试”)
];
}
}
}
},
开放式:{
服务器:{
网址:'http://localhost:'
}
},
清洁:{
地区:['.tmp','/*'],
服务器:'.tmp'
},
jshint:{
选项:{
jshintrc:“.jshintrc”
},
全部:[
“Gruntfile.js”,
“/scripts/{,*/}*.js”
]
},
业力:{
单位:{
configFile:'karma.conf.js',
singleRun:对
}
},
咖啡:{
地区:{
档案:{
“.tmp/scripts/coffee.js”:“/scripts/*.coffee”
}
},
测试:{
档案:[{
是的,
cwd:“.tmp/spec”,
src:“*.咖啡”,
目的:“测试/规格”
}]
}
},
指南针:{
选项:{
sassDir:“/styles”,
cssDir:“.tmp/styles”,
imagesDir:“/images”,
javascriptsDir:“/scripts”,
fontsDir:“/styles/fonts”,
importPath:“/components”,
相对论:对
},
地区:{},
服务器:{
选项:{
debugInfo:true
}
}
},
康卡特:{
地区:{
档案:{
“/scripts/scripts.js”:[
'.tmp/scripts/{,*/}*.js',
“/scripts/{,*/}*.js”
]
}
}
},
使用准备:{
html:“/index.html”,
选项:{
目标:“”
}
},
usemin:{
html:['/{,*/}*.html'],
css:['/styles/{,*/}*.css'],
选项:{
目录:['']
}
},
imagemin:{
地区:{
档案:[{
是的,
cwd:“/images”,
src:“{,*/}*{png,jpg,jpeg}”,
目标:'/images'
}]
}
},
cssmin:{
地区:{
档案:{
“/styles/main.css”:[
“.tmp/styles/{,*/}*.css”,
“/styles/{,*/}*.css”
]
}
}
},
htmlmin:{
地区:{
选项:{
/*removeCommentsFromCDATA:true,
// https://github.com/yeoman/grunt-usemin/issues/44
//拼贴空白:对,
collapseBooleanAttributes:没错,
RemoveAttribute属性:对,
删除和声明:是的,
useShortDoctype:true,
RemovemptyAttributes:没错,
removeOptionalTags:true*/
},
档案:[{
是的,
cwd:“”,
src:['*.html','views/*.html'],
目标:“”
}]
}
},
cdnify:{
地区:{
html:['/*.html']
}
},
ngmin:{
地区:{
档案:[{
是的,
cwd:“/scripts”,
src:'*.js',
目标:'/scripts'
}]
}
},
丑陋的:{
地区:{
档案:{
“/scripts/scripts.js”:[
“/scripts/sc
<link rel="stylesheet" href="styles/style.css">
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/base.css">
<link rel="stylesheet" href="styles/modules.css">
<link rel="stylesheet" href="styles/layout.css">
<!-- endbuild -->
mountFolder(connect, '.tmp'),