我们可以使用npm作为依赖关系管理器加载angularjs或其他js框架。对于如何使用gulp从node_modules文件夹加载所有依赖项,以及稍后将所有文件连接到单个文件,我有疑问。我也知道使用browserify。但是当使用药剂的时候它真的起作用了?有人经历过吗?
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();
};
});和gulpFile
elixir(function(mix) {
mix.browserify("app.js");
});发布于 2015-06-07 15:01:22
对于仍未使用浏览器化的用户,请运行npm update。Browserify非常聪明,可以从node_module文件夹中找到所有依赖项,并将所有文件连接到单个文件中。
https://stackoverflow.com/questions/30685032
复制相似问题