我正在使用Grunt从大量的部分SCSS文件中观察和编译我的CSS。因此,当我更新任何SCSS文件时,手表会生成一个更新的main.css文件。这是可以的,但我注意到所有的类似乎都用以下代码包装,例如
@media -sass-debug-info{filename{font-family:file:///Users/username/Projects/my-gitclone/projectname/src/htdocs/an/app/styles/utilities/_display.scss}line{font-family: 000354}}
.u-body-noscroll {
overflow: hidden;
}
我不明白手表为什么插入这个@media -sass-debug-info{filename{}line{font-family: 000XXX}}
,我认为这可能是由于我的_fonts.scss
文件中的错误,但这很好,url值是相对的:
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 400;
src: url('fonts/Merriweather.woff2') format('woff2'),
url('fonts/Merriweather.woff') format('woff'),
url('fonts/Merriweather.ttf') format('truetype');
}
@font-face {
font-family: 'Merriweather';
font-style: normal;
font-weight: 700;
src: url('fonts/MerriweatherBold.woff2') format('woff2'),
url('fonts/MerriweatherBold.woff') format('woff'),
url('fonts/MerriweatherBold.ttf') format('truetype');
}
我还认为我的_icon-font.scs可能是问题的根源,但这是正确的吗?IDE或Grunt会添加这个@media -sass-debug-info
吗?
我使用Grunt作为我的手表/任务运行程序,使用IntelliJ作为我的IDE,有人遇到过这个问题吗?
我想我找到了答案。。。在Grunt文件中,我将debugInfo: false
添加到compass.dist和compass.server任务中。
// Compiles Sass to CSS and generates necessary files if requested
compass: {
options: {
sassDir: '<%= yeoman.app %>/styles',
cssDir: '<%= yeoman.app %>/styles',
generatedImagesDir: '.tmp/images/generated',
imagesDir: '<%= yeoman.app %>/images',
javascriptsDir: '<%= yeoman.app %>/scripts',
fontsDir: '<%= yeoman.app %>/styles/fonts',
importPath: './bower_components',
httpImagesPath: '/images',
httpGeneratedImagesPath: '/images/generated',
httpFontsPath: '/styles/fonts',
relativeAssets: false,
assetCacheBuster: false,
raw: 'Sass::Script::Number.precision = 10n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated',
debugInfo: false
}
},
server: {
options: {
debugInfo: false
}
}
},