![](/img/trans.png)
[英]Strange “debug” error in sass output: @media -sass-debug-info… cluttering css file
[英]Issue with @media -sass-debug-info{filename when Grunt creates CSS from SCSS
我正在使用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:\0000354}}
.u-body-noscroll {
overflow: hidden;
}
我不明白為什么手表要插入此@media -sass-debug-info{filename{}line{font-family:\\0000XXX}}
,我認為這可能是由於_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.scss可能是問題的根源,但這是正確的嗎? IDE或Grunt可以添加此@media -sass-debug-info
嗎?
我在手表/任務執行器上使用Grunt,在IDE中使用IntelliJ,有人遇到過此問題嗎?
我想我找到了一個答案...在我的Grunt文件中,我為debug.com和guide.server任務添加了debugInfo: false
。
// 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 = 10\n'
},
dist: {
options: {
generatedImagesDir: '<%= yeoman.dist %>/images/generated',
debugInfo: false
}
},
server: {
options: {
debugInfo: false
}
}
},
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.