2014-10-28 40 views
0

使用Sass with sourcemaps对于未使用CSS的CSS可以正常工作,但是使用缩小的CSS却没有。 我猜这可能是因为引用首先得到的内置到编译后的css文件,但缩小版本改变了一切,引用然后失败,可能是这样吗?如果是这样,我仍然不知道该怎么做。任何帮助找到解决方案将不胜感激。带缩小文件的sass源地图(grunt)

这是我在我的主* SCSS文件的最后一行:

/*# sourceMappingURL=mytheme-full.css.map */ 

我想;如果我只是改变以下,它应该工作。但不是!

/*# sourceMappingURL=mytheme-full-min.css.map */ 

这是从我Gruntfile.js:

cssmin: { 
     build: { 
      files: { 
       'sites/all/themes/mytheme/css/mytheme-full-min.css': 'sites/all/themes/mytheme/css/mytheme-full.css' 
      } 
     } 
    }, 

    sass: { 
     dist: { 
      options: { 
       sourcemap: 'auto' 
      }, 
      files: { 
       'sites/all/themes/mytheme/css/mytheme-full.css': 'sites/all/themes/mytheme/sass/mytheme-full.scss' 
      } 
     } 
    }, 
+0

我在这里遇到同样的问题。你有没有设法让它工作? – user1375026 2014-11-26 14:17:49

回答

1

迄今为止,咕噜-的contrib-cssmin不支持sourcemaps(见herehere)。

但是,grunt-contrib-sass和grunt-autoprefixer都支持源地图,所以最好的办法是对这些源地图启用sourcemaps,并使用unminified css进行开发和调试。要在autoprefixer中启用源地图,只需设置:

options: { 
    map: true 
}