Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Purge works with CLI but not Gulp #2

Open
LukasRos opened this issue Sep 18, 2019 · 3 comments
Open

Purge works with CLI but not Gulp #2

LukasRos opened this issue Sep 18, 2019 · 3 comments

Comments

@LukasRos
Copy link

I've encountered an issue wherein I'm trying to purge a (third-party) CSS file and I'm getting the following error:

CSS Parser Error: probably have something funny in your CSS, change it then please try again.
Reason: missing '}'
Line: 157
Column: 1
Filename: demo/test1.css

There is no missing } in the line mentioned nor anywhere else in the file as far as I'm aware. The filename is also not demo/test1.css.

Here is my Gulp code:

const gulp = require('gulp');
const concat = require('gulp-concat');
const streamqueue = require('streamqueue');
const cssPurge = require('gulp-css-purge');

// Concatenate and minify stylesheets
gulp.task('styles', function() {
    // inspired by https://stackoverflow.com/a/23507836
    return streamqueue({ objectMode: true },
        gulp.src('./node_modules/purecss/build/pure.css'),
        gulp.src('./static/app.css'),
        gulp.src('./node_modules/codemirror/lib/codemirror.css'),
    )
    .pipe(concat('styles.css'))
    .pipe(cssPurge({
        trim : true,
        shorten : true,
        verbose : false
    }))
    .pipe(gulp.dest('./static'));
});

The problem is with the ./node_modules/codemirror/lib/codemirror.css file because when I comment this line I can purge the other two without issues. The problem is also not with concatenation or the use of streamqueue because even without it I get the same error.

Now, the following run from CLI works without any problem and produces a valid minified CSS file:

./node_modules/.bin/css-purge -i ./node_modules/codemirror/lib/codemirror.css

Therefore I assume there's a problem in this package and not in css-purge itself.

@AndrewEQ
Copy link
Contributor

Hey @LukasRos, can you please share the CSS files for me to have a look at what's happening with that specific combination?

@LukasRos
Copy link
Author

@AndrewEQ
Copy link
Contributor

AndrewEQ commented Nov 5, 2019

Sorry its been awhile, been really busy, will take a look at it soon @LukasRos

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants