Comments (16)
i havnt planned for it but you could use the prebundle
callback to achieve it right now. If this is very much needed will add it.
from gulp-browserify.
❤️❤️❤️❤️
from gulp-browserify.
@karellm the shortify transform might get you there in the meantime.
from gulp-browserify.
@deepak1556 Not sure how I would use it. I tried this without much success:
gulp.task('browserify', function() {
return gulp.src('app/initialize.coffee', { read: false })
.pipe(
browserify({
transform: ['coffeeify', 'hbsfy'],
extensions: ['.coffee', '.hbs'],
insertGlobals : true,
debug : !gutil.env.production
})
.on('prebundle', function(bundler) {
bundler.require(__dirname + '/app/controllers/home-controller');
})
)
.pipe(rename("frontend.js"))
.pipe(gulp.dest('public/js'))
});
I need the loaded file to be aliased to controllers/home-controller
. FYI, I use chaplin. The library dynamically require the controllers. That's why the aliasMapping comes in handy as it lets you require a full directory.
@greypants Thanks but this doesn't work for my use case. I need to load all the files within a directory without ideally manually listing them.
from gulp-browserify.
@karellm I'm not sure about neither grunt nor chaplin, but as long as I read grunt-browserify's source, aliasMapping just calls require()
with expose
option. Does this work for you?
bundler.require(__dirname + '/app/controllers/home-controller.coffee', { expose: 'controllers/home-controller' });
If so, we can create a function to call require()
based on given config object.
from gulp-browserify.
yup @shuhei it does work. but i think it would be nice if we provide config option for aliasmapping :)
from gulp-browserify.
Thanks a ton! You made my day!
Support for aliasMapping would still be nice. Right now I need to list my directory manually in my gulpfile which is not very sustainable. I let you see if you wanna close or not :)
from gulp-browserify.
+1 for alias mapping directly in the top-level options. It's a core browserify feature. prebundle works but beginners to gulp-browserify have to waste time trying to figure it out.
from gulp-browserify.
+1
from gulp-browserify.
+1
from gulp-browserify.
+1
from gulp-browserify.
We really need it!
from gulp-browserify.
+1
from gulp-browserify.
Sorry i have stopped working on this. This plugin needs a proper rewrite.
from gulp-browserify.
@shuhei expose
works fine, ty.
@deepak1556 what will be with gulp-browserify in the future? Should we look for alternatives or are you working on it?
from gulp-browserify.
Nope i am nt planning on any rewrite. you can look into this thread for suggestions https://github.com/gulpjs/plugins/issues/47
from gulp-browserify.
Related Issues (20)
- Drop gulp-util dependency HOT 1
- During Bundling: Error: react-router-dom/NavLink.js: Line 48: Invalid regular expression HOT 1
- Externalizing shim to config suggestion?
- debowerify seems to prevent `.external()` from working HOT 1
- 'Uncaught Error: Cannot find module 'function e(t,n,r)... HOT 4
- browserify+ coffeeify+ preprocess cannot work right.Here's my gulpfile.
- node_modules being included HOT 3
- Error: need proper browserify instance, on windows machine HOT 2
- ignore do not support the relative path
- babelify 7.2.0 doesn't work fork
- [email protected] doesn't work in gulp-browserify
- How to do files: multiple sources to new file like grunt HOT 1
- Help options transform babelify
- how can i user that module like this?
- Unexpected reserved word (mounted) for Vue.js
- 'nobuiltins' options is not working in certain circumstances
- Unexpected token => HOT 3
- 编译 报错
- Cede the package name on NPM to gulp-bro HOT 9
- ParseError: 'import' and 'export' may only appear at the top level
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gulp-browserify.