Skip to content

Using parcelify with Grunt  #39

Description

@prayagverma

I am using grunt-browserify and trying integrate parcelify with it.

I used the the preBundleCB task option provided by grunt-browserify and created a grunt configuration like

var browserify = require('browserify');
var parcelify = require('parcelify');
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-browserify');
var taskConfig = {
    pkg: grunt.file.readJSON('package.json'),
    browserify: {
        main: {
            src: 'entry.js',
            dest: 'bundle.js'
        },
        options: {
            browserifyOptions: {debug:true},
            preBundleCB: function(b){
                return parcelify(b,{});
            }
        }
    }
};
grunt.initConfig(grunt.util._.extend(taskConfig));
};

This task doesn't fail but the parcelify plugin doesn't generate the CSS file.

But when running it from command line , it works without issue , I used the following command

browserify entry.js -o bundle.js -p [ parcelify -o bundle.css ]

After investigating , I found that the callback passed as parameter to _this.instantiateParcelAndPackagesFromMap ( https://github.com/rotundasoftware/parcelify/blob/v2.1.0/index.js#L122 ) function never gets executed.

I have working version of my code at https://github.com/pra85/grunt-browserify-example

Any help or advice for this issue would be really appreciated , Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions