2 votes

Laravel elixir 5.2 ne combine pas les scripts dans la tâche étendue

Mon code dans gulpfile.js est :

elixir.config.assetsPath = '';
elixir.config.js.folder = '';
var Task = elixir.Task;
var Mix = elixir.mixins;

elixir.extend('user', function () {

    new Task('user', function () {

        Mix.scripts(
            [
                '/resources/assets/js/angular/user/app/',
                '/resources/assets/js/angular/user/main/',
                '/resources/assets/js/angular/user/configs/',
                '/public/app/user/libs/angular/ui-bootstrap/ui-bootstrap-custom-2.0.0.js',
                '/resources/assets/js/angular/user/models/',
                '/public/app/libs/angular/ng-typeahead/dist/ng-typeahead.js',
                '/resources/assets/js/angular/user/controllers/',
                'public/app/libs/angular/angularjs-toaster/toaster.js',
                '/resources/assets/js/angular/user/filters/',
                '/resources/assets/js/angular/admin/directives/googlemap/map.js',
                '/public/app/libs/assets/custom-lodash.js',
                '/resources/assets/js/angular/user/services/',
                '/resources/assets/js/angular/user/directives/',
                '/public/app/user/assets/js/bootstrap.3.3.5.js',
                '/public/app/user/assets/js/ui-bootstrap-tpls-2.0.0.js',
                '/public/app/user/assets/js/slick.js',
                '/public/app/user/assets/js/angular-slick.min.js',
                '/public/app/user/assets/js/bootstrap-chosen.js',
                '/public/app/user/assets/js/fixto.min.js',
                '/public/app/user/ngApp/templates/templates.js'
            ],
            'public/app/user/ngApp/scripts/app-all.js'
        ).sass(
            [
                './public/app/user/assets/sass/main.scss'
            ],
            './public/app/user/assets/css/kit.css'
        ).styles(
            [
                './public/app/user/assets/css/bootstrap.css',
                './public/app/user/assets/css/font.css',
                './public/app/user/assets/css/kit.css',
                './public/app/user/assets/css/range-slider.css',
                './public/app/user/assets/css/angular-bootstrap-lightbox.css',
                './public/app/libs/angular/angularjs-toaster/toaster.css',
                './public/app/libs/angular-rateit/dist/rateit.css',
                './public/app/libs/angular/ng-typeahead/dist/ng-typeahead.css',
                './public/app/user/assets/css/app.css',
                './public/app/user/assets/css/nga.all.min.css',
                './public/app/user/assets/css/rzslider.css',
                './public/app/user/assets/css/slick.css',
                './public/app/user/assets/css/slick-theme.css',
                './public/app/user/assets/css/animate.css',
                './public/app/user/libs/jquery/select2/dist/css/select2.min.css'
            ],
            './public/app/user/assets/css/app-all.css'
        ).version(
            [
                'public/app/user/assets/css/app-all.css',
                'public/app/user/ngApp/scripts/app-all.js'
            ]
        );
    });
});

quand j'exécute (gulp user) dans le terminal, le résultat est vide comme ceci, et la combinaison des scripts et des styles ne fonctionne pas correctement

[15:20:00] Using gulpfile /var/www/chilivery/web/gulpfile.js
[15:20:00] Starting 'user'...
┌────────────┬─────────┬──────────────┬─────────────┐
│ Task       │ Summary │ Source Files │ Destination │
├────────────┼─────────┼──────────────┼─────────────┤
│ mix.user() │         │
└────────────┴─────────┴──────────────┴─────────────┘
[15:20:00] Finished 'user' after 6.36 ms

Toute aide S'il vous plaît, comment puis-je créer une commande gulp comme gulp user pour gérer cela ?

1voto

Cedric Points 1135

Commençons par oublier la partie "tâche personnalisée" d'abord.

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

elixir(function(mix) {
    mix.scripts(
            [
                'resources/assets/js/angular/user/app/',
                'resources/assets/js/angular/user/main/',
                'resources/assets/js/angular/user/configs/',
                'public/app/user/libs/angular/ui-bootstrap/ui-bootstrap-custom-2.0.0.js',
                'resources/assets/js/angular/user/models/',
                'public/app/libs/angular/ng-typeahead/dist/ng-typeahead.js',
                'resources/assets/js/angular/user/controllers/',
                'public/app/libs/angular/angularjs-toaster/toaster.js',
                'resources/assets/js/angular/user/filters/',
                'resources/assets/js/angular/admin/directives/googlemap/map.js',
                'public/app/libs/assets/custom-lodash.js',
                'resources/assets/js/angular/user/services/',
                'resources/assets/js/angular/user/directives/',
                'public/app/user/assets/js/bootstrap.3.3.5.js',
                'public/app/user/assets/js/ui-bootstrap-tpls-2.0.0.js',
                'public/app/user/assets/js/slick.js',
                'public/app/user/assets/js/angular-slick.min.js',
                'public/app/user/assets/js/bootstrap-chosen.js',
                'public/app/user/assets/js/fixto.min.js',
                'public/app/user/ngApp/templates/templates.js'
            ],
            'public/app/user/ngApp/scripts/app-all.js'
        );
    mix.styles(
            [
                'public/app/user/assets/css/bootstrap.css',
                'public/app/user/assets/css/font.css',
                'public/app/user/assets/css/kit.css',
                'public/app/user/assets/css/range-slider.css',
                'public/app/user/assets/css/angular-bootstrap-lightbox.css',
                'public/app/libs/angular/angularjs-toaster/toaster.css',
                'public/app/libs/angular-rateit/dist/rateit.css',
                'public/app/libs/angular/ng-typeahead/dist/ng-typeahead.css',
                'public/app/user/assets/css/app.css',
                'public/app/user/assets/css/nga.all.min.css',
                'public/app/user/assets/css/rzslider.css',
                'public/app/user/assets/css/slick.css',
                'public/app/user/assets/css/slick-theme.css',
                'public/app/user/assets/css/animate.css',
                'public/app/user/libs/jquery/select2/dist/css/select2.min.css'
            ],
            'public/app/user/assets/css/app-all.css'
        );

    mix.version(
            [
                'public/app/user/assets/css/app-all.css',
                'public/app/user/ngApp/scripts/app-all.js'
            ]
        );

});

Ici, il n'y a pas de tâche personnalisée utilisée, les chemins sont toujours similaires (sans / ou ./ devant), et nous avons évité d'enchaîner les appels de fonctions mix - tout cela dans le but de déboguer et d'essayer de faire fonctionner votre code

Quel résultat avez-vous obtenu ? Quelle sortie avez-vous dans votre console/terminal ? Quelle sortie avez-vous dans

  • public/app/user/ngApp/scripts/app-all.js
  • public/app/user/assets/css/kit.css
  • et public/app/user/assets/css/app-all.css

Prograide.com

Prograide est une communauté de développeurs qui cherche à élargir la connaissance de la programmation au-delà de l'anglais.
Pour cela nous avons les plus grands doutes résolus en français et vous pouvez aussi poser vos propres questions ou résoudre celles des autres.

Powered by:

X