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
| # do NOT cut and paste, hidden surprise here! | |
| $ChocoInstallPath = "$env:SystemDrive\ProgramData\Chocolatey\bin" | |
| if (!(Test-Path $ChocoInstallPath)) { | |
| iex ((new-object net.webclient).DownloadString('https://chocolatey.org/install.ps1')) | |
| } |
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
| $ gulp browserify | |
| [06:48:59] Using gulpfile ~/work/boilerplate/gulpfile.js | |
| [06:48:59] Starting 'browserify'... | |
| [06:49:01] Finished 'browserify' after 1.59 s | |
| $ ls -lh ./dist | |
| total 1312 | |
| -rw-r--r-- 1 Roman home 654K Feb 23 09:49 bundle.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
| // convert React components to be used in the browser | |
| gulp.task('browserify', function() { | |
| var babelifyConfig = babelify.configure({presets: ['es2015', 'react'], extensions: ['.jsx']}); | |
| return browserify({ | |
| entries: 'src/app.jsx', // the same as "--extension=.jsx src/**/*.jsx" | |
| extensions: ['.jsx'] | |
| }) | |
| .transform(babelifyConfig) // the same as -t command line parameter | |
| .bundle() // "readable stream with the javascript file contents" |
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 source = require('vinyl-source-stream'); | |
| // ... | |
| .transform(babelifyConfig) // the same as -t command line parameter | |
| .bundle() // "readable stream with the javascript file contents" | |
| .pipe(source('bundle.js')) // "conventional text stream at the start of our gulp pipeline", wrapped with "pipe" method | |
| .pipe(gulp.dest('dist')); // standard gulp way to redirect gulp pipe to directory |
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
| gulp.task('browserify', function() { | |
| var babelifyConfig = babelify.configure({presets: ['es2015', 'react'], extensions: ['.jsx']}); | |
| return browserify({ | |
| entries: 'src/app.jsx', // the same as "--extension=.jsx src/**/*.jsx" | |
| extensions: ['.jsx'] | |
| }) | |
| .transform(babelifyConfig) // the same as -t command line parameter | |
| .bundle() | |
| .pipe(process.stdout); |
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 browserify = require('browserify'); | |
| var b = browserify(); | |
| b.add('./browser/main.js'); | |
| b.bundle().pipe(process.stdout); |
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 babelifyConfig = babelify.configure({presets: ['es2015', 'react']}); | |
| return browserify({ | |
| entries: 'src/app.jsx', | |
| extensions: ['.jsx'] | |
| }) | |
| .transform(babelifyConfig) // the same as -t command line parameter |
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 browserify = require('browserify'); | |
| var babelify = require('babelify'); |
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
| $ node_modules/.bin/browserify --extension=.jsx src/**/*.jsx -o bundle.js -t [ babelify --presets [ es2015 react ] ] |
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
| <body> | |
| <div id="app"></div> | |
| <script type="text/javascript" src="bundle.js"></script> | |
| </body> |