Search code examples
phpangularjslaravel-elixir

use laravel elixir npm to manage front dependencies


we are able to load angularjs or other js framework using npm as manager of dependencies. I am in doubt on how to use gulp to load all the dependencies from node_modules folder and later concat all files into single file. I'm also aware the use of browserify. But it actually work when using Elixir? Any one experience this?

var angular = require('angular');

angular
    .module('myApp', [require('angular-material')]))
    .controller('MainCtrl', function($rootScope, $scope, $mdToast, $animate, $http, $timeout, $q, $log) {
        'use strict';
        // Initialize the scope variables
        $scope.applicant = {};
        $scope.submit = function(e) {
            e.preventDefault();
        };
    });

and gulpFile

elixir(function(mix) {
    mix.browserify("app.js");
});

Solution

  • For those who still fail to use browserify, please run npm update. Browserify is smart enough to find all the dependencies from node_module folder and concat all files into single file.