Laravel elixir - 不生成地图文件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/28930454/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Laravel elixir - don't generate map files
提问by Marcin Nabia?ek
The question is - how to force Laravel Elixir not to generate map files?
问题是 - 如何强制 Laravel Elixir 不生成地图文件?
At the moment if I run gulp
I will have generated app.css
and app.css.map
file. I don't know what for is this app.css.map
file but I think it's not necessary for me at the moment. Question is - how to force gulp not to generate this file?
目前,如果我运行,gulp
我将生成app.css
并app.css.map
归档。我不知道这个app.css.map
文件有什么用,但我认为目前对我来说没有必要。问题是 - 如何强制 gulp 不生成此文件?
At the moment my gulpfile.js
looks like this:
目前我的gulpfile.js
样子是这样的:
var elixir = require('laravel-elixir');
elixir(function(mix) {
mix.sass('app.scss', 'public/css/app.css');
});
采纳答案by lukasgeiter
.map
files are called source maps. Their purpose is to mapthe contents of a concatenated, minified file to it's original files to make debugging easier.
.map
文件称为源映射。它们的目的是将连接的、缩小的文件的内容映射到它的原始文件,以便于调试。
You can disable them by changing elixirs config using extend()
in your gulpfile
您可以通过extend()
在您的 gulpfile 中使用更改elixirs配置来禁用它们
elixir.extend('sourcemaps', false);
Note that source maps are disabled by default when running in production.
请注意,在生产环境中运行时,默认情况下禁用源映射。
回答by nCrazed
This is no longer achievable via elixir.extend()
syntax, instead the official documentationnow suggests to use this:
这不再可以通过elixir.extend()
语法实现,而是官方文档现在建议使用它:
elixir.config.sourcemaps = false;
回答by Kazik
Starting from Elixir 3.0you can put a JSON object that will override the default configuration in elixir.json
:
从Elixir 3.0开始,您可以放置一个 JSON 对象来覆盖默认配置elixir.json
:
{
"sourcemaps": false
}