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

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-14 11:05:31  来源:igfitidea点击:

Laravel elixir - don't generate map files

laravelgulplaravel-elixir

提问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 gulpI will have generated app.cssand app.css.mapfile. I don't know what for is this app.css.mapfile 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.cssapp.css.map归档。我不知道这个app.css.map文件有什么用,但我认为目前对我来说没有必要。问题是 - 如何强制 gulp 不生成此文件?

At the moment my gulpfile.jslooks like this:

目前我的gulpfile.js样子是这样的:

var elixir = require('laravel-elixir');

elixir(function(mix) {
    mix.sass('app.scss', 'public/css/app.css');
});

采纳答案by lukasgeiter

.mapfiles 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
}