Giter Club home page Giter Club logo

Comments (16)

deepak1556 avatar deepak1556 commented on June 3, 2024

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.

greypants avatar greypants commented on June 3, 2024

❤️❤️❤️❤️

from gulp-browserify.

greypants avatar greypants commented on June 3, 2024

@karellm the shortify transform might get you there in the meantime.

from gulp-browserify.

karellm avatar karellm commented on June 3, 2024

@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.

shuhei avatar shuhei commented on June 3, 2024

@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.

deepak1556 avatar deepak1556 commented on June 3, 2024

yup @shuhei it does work. but i think it would be nice if we provide config option for aliasmapping :)

from gulp-browserify.

karellm avatar karellm commented on June 3, 2024

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.

tavisrudd avatar tavisrudd commented on June 3, 2024

+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.

nivoc avatar nivoc commented on June 3, 2024

+1

from gulp-browserify.

psi-4ward avatar psi-4ward commented on June 3, 2024

+1

from gulp-browserify.

BerkeleyTrue avatar BerkeleyTrue commented on June 3, 2024

+1

from gulp-browserify.

MaxSvargal avatar MaxSvargal commented on June 3, 2024

We really need it!

from gulp-browserify.

nielswind avatar nielswind commented on June 3, 2024

+1

from gulp-browserify.

deepak1556 avatar deepak1556 commented on June 3, 2024

Sorry i have stopped working on this. This plugin needs a proper rewrite.

from gulp-browserify.

zsitro avatar zsitro commented on June 3, 2024

@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.

deepak1556 avatar deepak1556 commented on June 3, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.