Created
April 13, 2015 16:41
-
-
Save shuhei/3f3a2d0c8b8bae44d3a8 to your computer and use it in GitHub Desktop.
Browserify + Angular: separate vendor and app js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var angular = require('angular'); | |
angular.module('myapp', []) | |
.controller('AppController', function ($scope) { | |
$scope.name = 'Browserify Angular App'; | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<script src="dist/vendor.js"></script> | |
<script src="dist/app.js"></script> | |
</head> | |
<body ng-app="myapp"> | |
<div ng-controller="AppController"> | |
Hello, {{name}}! | |
</div> | |
</body> | |
</html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"name": "browsrify-angular-test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"vendor": "mkdir -p dist && browserify --require angular > dist/vendor.js", | |
"app": "mkdir -p dist && browserify --external angular app.js > dist/app.js", | |
"build": "npm run vendor && npm run app" | |
}, | |
"author": "Shuhei Kagawa", | |
"license": "ISC", | |
"dependencies": { | |
"angular": "^1.3.15" | |
}, | |
"devDependencies": { | |
"browserify": "^9.0.8" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment