Last active
July 11, 2017 15:48
-
-
Save preslavrachev/44263bcbbb6395b7821a to your computer and use it in GitHub Desktop.
Integrating browserify into an Ionic project
This file contains 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 customModule = require('./custom-module'); | |
var app = angular.module('myApp', ['ionic']); | |
... |
This file contains 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 rename = require('gulp-rename'); | |
var browserify = require('gulp-browserify'); | |
var paths = { | |
... | |
js: ['./www/js/**/*.js'] | |
}; | |
gulp.task('default', ['sass','browserify']); | |
gulp.task('browserify', function() { | |
// Single entry point to browserify | |
gulp.src('www/js/app.js') | |
.pipe(browserify({ | |
insertGlobals : true, | |
debug : false | |
})) | |
.pipe(rename(function(path) { | |
path.basename += ".dist"; | |
})) | |
.pipe(gulp.dest('www/js')) | |
}); | |
gulp.task('watch', function() { | |
... | |
gulp.watch(paths.js, ['browserify']); | |
}); | |
... |
This file contains 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
<!--- <script src="js/app.js"></script> --> | |
<!-- Use the generated app.dist.js, instead of app.js --> | |
<script src="js/app.dist.js"></script> |
This file contains 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
{ | |
... | |
"gulpStartupTasks": ["browserify", "sass", "watch"] | |
} |
This file contains 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
{ | |
"dependencies": { | |
... | |
"gulp-browserify": "^0.5.0", | |
"base64-js": "^0.0.7", // caused an error without it | |
"ieee754": "^1.1.4" // caused an error without it | |
... | |
"gulp-rename": "^1.2.0", //wasn't included among the base gulp plugins | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment