为什么Laravel Elixir没有缩小我的代码?

时间:2016-06-18 06:37:51

标签: laravel gulp laravel-elixir

我正在使用laravel elixir来编译和缩小我的代码。但出于某种原因,当我执行 gulp -production 任务时,我仍然没有得到缩小的代码。我很想将缩小的javascript和css代码用于制作。

我的gulpfile:

'use strict';

process.env.DISABLE_NOTIFIER = false;

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

elixir(function(mix) {
    mix.sass([
        './resources/assets/css/**/**/*.scss'
    ], 'public/css/style.css');

    mix.scripts([
       'app.js'
    ], 'public/js/angular/app.js');

    mix.scripts([
       'jquery/chosenSelect.js',
       'jquery/fileUpload.js',
       'jquery/velocity.min.js',
       'jquery/leanModal.js',
       'jquery/sectionScroll.js'
    ], 'public/js/jquery.js');

    mix.scripts([
        'services/OverheatingService.js'
    ], 'public/js/angular/services/services.js');

    mix.scripts([
        'controllers/LoopController.js',
        'controllers/AlertController.js',
        'controllers/LibraryController.js',
        'controllers/StationController.js',
        'controllers/ProfileController.js',
        'controllers/HomeController.js',
        'controllers/MainController.js',
        'controllers/RecordController.js',
        'controllers/SpecificuserController.js',
        'controllers/DeleteAccountController.js',
        'controllers/RegisterController.js',
        'controllers/EditProfileController.js',
        'controllers/SpecificLoopController.js',
        'controllers/SpecificTagController.js'
    ], 'public/js/angular/controllers/controllers.js');

    mix.scripts([
        'directives/tooltip.js',
        'directives/smoothScroll.js'
    ], 'public/js/angular/directives/directives.js');
});

//To watch changes in sass files
elixir.Task.find('sass').watch('./resources/assets/css/**/*.scss');

1 个答案:

答案 0 :(得分:2)

该命令为gulp --production gulp - production

您还可以查看Elixir Docs for Running Elixir