Javascript Grunt Sass到CSS未构建
目前我有Javascript Grunt Sass到CSS未构建,javascript,Javascript,目前我有app/styles/main.scss,我的sass被分解成多个结构化文件并导入main.scss。在我的index.html中,我有以下内容: <!-- build:css styles/main.css --> <link rel="stylesheet" href="styles/main.css"> <!-- endbuild --> sass: { dist: { files: [{ expand: true,
app/styles/main.scss
,我的sass被分解成多个结构化文件并导入main.scss
。在我的index.html
中,我有以下内容:
<!-- build:css styles/main.css -->
<link rel="stylesheet" href="styles/main.css">
<!-- endbuild -->
sass: {
dist: {
files: [{
expand: true,
cwd: '<%= yeoman.app %>/styles/modules',
src: ['_infowindow.scss'],
dest: '.tmp/cdn/'
}]
}
},
终端输出以下信息:
Running "sass:dist" (sass) task
Verifying property sass.dist exists in config...OK
Files: app/styles/modules/_infowindow.scss -> .tmp/cdn/_infowindow.css
Options: (none)
但是当我检查.tmp
的目录时,没有cdn
的目录
其他:
这是我当前的指南针设置
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '.tmp/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/fonts',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated'
}
},
server: {
options: {
sourcemap: true
}
}
}
//将Sass编译为CSS,并在需要时生成必要的文件
指南针:{
选项:{
sassDir:“/styles”,
cssDir:“.tmp/styles”,
generatedImagesDir:'.tmp/images/generated',
imagesDir:“/images”,
javascriptsDir:“/scripts”,
fontsDir:“/fonts”,
进口路径:'./鲍尔_组件',
httpImagesPath:“/images”,
httpGeneratedImagesPath:“/images/generated”,
httpFontsPath:“/fonts”,
相对论:错,
AssetCachBuster:错,
raw:'Sass::Script::Number.precision=10\n'
},
地区:{
选项:{
generatedImagesDir:“/images/generated”
}
},
服务器:{
选项:{
sourcemap:true
}
}
}
您应该重命名文件,使其不使用下划线,因此不再是部分文件,并在grunt任务中使用不带下划线的新名称。是否尝试从文件名中删除下划线:使用infowindow而不是_infowindow.scss。scss@Nora是的,但它返回源文件“app/styles/modules/infowindow.scss“未找到。您是否也重命名了该文件?您应该重命名该文件,并在grunt中使用不带下划线的新名称task@Nora我的文件结构都以下划线开头。我已经重命名了infowindow文件,必须导入我的mixin文件。我想我们可能会有答案@诺拉把它作为回答,我会接受的