frontendfriends / gulp-combine-mq

Gulp wrapper for 'node-combine-mq'
http://github.com/frontendfriends/node-combine-mq
41 stars 8 forks source link

Module errors out on gulp build. #9

Open JimmyMultani opened 9 years ago

JimmyMultani commented 9 years ago

I've been trying to incorporate this plugin into my gulp build, but it keeps erroring out when I attempt to run gulp. This is what I get:

C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-parse\node_modules\css\l
ib\parse\index.js:72
      throw err;
            ^
Error: undefined:605:3: missing '}'
    at error (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-parse\node
_modules\css\lib\parse\index.js:62:15)
    at declarations (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-par
se\node_modules\css\lib\parse\index.js:259:26)
    at rule (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-parse\node_
modules\css\lib\parse\index.js:560:21)
    at rules (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-parse\node
_modules\css\lib\parse\index.js:117:70)
    at stylesheet (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-parse
\node_modules\css\lib\parse\index.js:81:21)
    at module.exports (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine-mq\node_modules\css-p
arse\node_modules\css\lib\parse\index.js:564:20)
    at Object.module.exports.parseCssString (C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\combine
-mq\lib\combine-mq.js:209:17)
    at C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\index.js:40:32
    at evalmachine.<anonymous>:334:14
    at C:\wamp\www\mirum\starter\node_modules\gulp-combine-mq\node_modules\graceful-fs\graceful-fs.js:102:5

This is the task that's failing:

// Node Sass
gulp.task('sass', function() {
    // List all .scss files that need to be processed
    return gulp.src([
            options.paths.sass + 'main.scss'
        ])

        .pipe(sourcemaps.init())

        .pipe(sass(options.libsass))

        // Catch any SCSS errors and prevent them from crashing gulp
        .on('error', function (error) {
            gutil.log(gutil.colors.red(error.message));
            this.emit('end');
        })

        // Hotfix while gulp-sass sourcemaps gets fixed
        // https://github.com/dlmanning/gulp-sass/issues/106#issuecomment-60977513
        .pipe(sourcemaps.write())
        .pipe(sourcemaps.init({loadMaps: true}))

        // Add vendor prefixes
        .pipe(autoprefixer(options.autoprefixer.support))

        .pipe(gutil.env.type === 'prod' ? combineMq() : gutil.noop())
        .pipe(gutil.env.type === 'prod' ? minifyCSS() : gutil.noop())

        // Write final .map file
        .pipe(sourcemaps.write())

        // Output the processed CSS
        .pipe(gulp.dest(options.paths.destCss))

        .pipe(notify('Sass compiled'))
        .pipe(size({title: 'CSS'}))
        .pipe(reload({stream:true}));
});

If I comment out the combineMq() call, the task runs fine.

Any idea what's going on? Thanks.

furzeface commented 9 years ago

Are you able to show me the main.scss you're using as the source for this task? Someone had a similar problem previously where the error was being thrown in css-parse and propagating up to be thrown in gulp-combine-mq and I was able to track down what was causing it to error in css-parse (which is a dependency of this plugin).

I'll take a look into why this might be.

JimmyMultani commented 9 years ago

Sure thing. Thank you for you quick response too, I think this plugin is fantastic! If you need me to link the other files, that can be arranged.

/*
  For:
  Author:
  Date:
*/

/*!
Project Name
*/

// Normalize.css
@import "normalize";

// @import "../../bower_components/susy/sass/susy";
@import "susy/susy";

// Mixins, helpers & variables (@font-face fonts are in variables)
@import "variables";
@import "mixins";
@import "helpers";

// Animations
@import "anim";

// Base/defaults (html, body, typography, headings, lists, etc)
@import "base";

// Layout, grid, header, footer
@import "layout";

// Modules (could be also used for page specific styles)
@import "modules";

// Others...
JimmyMultani commented 9 years ago

Hey @furzeface, any ideas on what might be the problem?

Hey @furzeface, it seems like the problem is a conflict with Susy. Commenting out Susy makes it work again. I'm not exactly sure if this still has to do with combine-mq or not. I guess combine-mq doesn't support Susy, maybe?

Thanks.

besimhu commented 9 years ago

Hi, just wanted to comment and say that this definitely is not related to Susy, but rather to how the mixins or something else is written. Okay, so in this case it's related in the way Susy built some component.

Additionally, I was getting the same error, and it was resulting from a mixin I was using. https://github.com/danielguillan/modernizr-mixin ... I tried looking at the mixin to figure out where it may have been breaking the output, but no luck.

However, I recently updated to gulp sass 2.0.0 ... the libsass version, and that seemed to have fixed the output.

Hope that helps in some way.

furzeface commented 9 years ago

Oh right, cheers guys for letting us know @besimhu @JimmyMultani - I'll investigate further into this :+1: