Questions tagged [gulp-uncss]

gulp-uncss is a gulp plugin that can remove unused CSS selectors.

gulp-uncss is a gulp plugin that can remove unused CSS selectors. It can be successfully used in a pipeline that involves other CSS related modifications like compilation, minification, etc.

Example of usage:

var gulp = require('gulp');
var uncss = require('gulp-uncss');

gulp.task('process-css', function() {
  return gulp.src('main.css')
    .pipe(uncss({
      html: ['index.html', 'templates/**/*.html']
    }))
    .pipe(gulp.dest('./build'));
});
17 questions
4
votes
1 answer

How to use gulp-uncss to also look into javascript file and .dust templates

My application is using dust template, HTML template and also javascript to build the view. I have lot of code in javascript which add/remove the css class based on the business logic. Also this application is quite old therefore I wanted to get rid…
joy
  • 3,669
  • 7
  • 38
  • 73
3
votes
2 answers

gulp-uncss removes class which is added using javascript

My gulp configuration for gulp-uncss is gulp.task('uncssme', function () { return gulp.src('src/css/**/*.css') .pipe(uncss({ html: ['src/**/*.html'] })) .pipe(gulp.dest('dist/css')) }); Using uncss removes 'newClass' selector…
master_dodo
  • 1,203
  • 3
  • 20
  • 31
2
votes
1 answer

Specify a different output css file name with gulp postcss-uncss

Is it possible to specify a different css file name as the output using the gulp plugin postcss-uncss?
mizanur
  • 33
  • 5
2
votes
0 answers

gulp-uncss error: unable to parse:

Having a problem with running gulp-uncss to get rid of all unused code. The mistake seems something to do with parsing of css. C:\wamp64\www\css-cleanup\node_modules\gulp-uncss\node_modules\uncss\node_modules\bluebird\js\release\async.js:48 …
nundel
  • 31
  • 4
2
votes
2 answers

uncss Error: C.UTF-8: not a valid language tag

Hi I am trying to use UNCSS to remove unused styles from CSS for the first time and I am getting the following error: Fontconfig warning: ignoring C.UTF-8: not a valid language…
user742030
1
vote
2 answers

Foundation build error

Cannon find the solution for a long period of time. When I use foundation watch everything is great, but every time I try to use foundation build I see this error: [21:05:45] 'sass' errored after 5.91 s [21:05:45] Error in plugin…
atanyday
  • 87
  • 1
  • 9
1
vote
1 answer

UnCSS ignore classes with regex

I need to match this bootstrap classes: '.col-lg-1', '.col-lg-2', '.col-lg-3', '.col-lg-4', '.col-lg-5', '.col-lg-6', '.col-lg-7', '.col-lg-8', '.col-lg-9', '.col-lg-10', '.col-lg-11', '.col-lg-12', …
aitor
  • 2,281
  • 3
  • 22
  • 44
1
vote
0 answers

unCSS ignore list globbing

Context I'm using gulp-uncss to remove unused CSS in a wordpress theme. It works fine, but unCSS can't recover styles from user account page because it is behind a login. All styles into account page are removed by unCSS. So, I am editing a ignore…
aitor
  • 2,281
  • 3
  • 22
  • 44
1
vote
1 answer

uncss, regex pattern for .no-'string', .is-'string'

I'm having some regex woes. Using gulp-uncss I'd like to add some classes to the ignore option. Any class that starts with .no- Any class that contains .is- .no-flexbox {} .test.is-active {} .test .is-hidden {} .pipe(uncss({ html:…
magicspon
  • 926
  • 2
  • 9
  • 28
0
votes
1 answer

Why is 'inline' called after 'scss' in this gulpfile?

I'm trying understand some of the details of this gulpfile from foundation-emails-template. Here is an excerpt from the file for the part I am curious about: // Build the "dist" folder by running all of the below tasks gulp.task('build', …
flyingL123
  • 7,686
  • 11
  • 66
  • 135
0
votes
0 answers

gulp.js Plugin uncss can't be installed

I want to install/use the Gulp-Plugin uncss (https://www.npmjs.com/package/gulp-un-css/) as my very first gulp-"try". I therefore installed npm and Gulp successfully globally with the CLI version 3.9.1. I also installed the uncss-plugin with npm…
Daiaiai
  • 1,019
  • 3
  • 12
  • 28
0
votes
1 answer

How does grunt uncss task work internally

I have written grunt uncss task to remove the unused css in my code. But its removing a lot of css which is being used in my code. I guess the reason is, its not checking for css inside the directive 'my-directive' Here is my index.html:
jass
  • 343
  • 3
  • 15
0
votes
1 answer

gulp uncss unexpectedly removing some "ignored" classes

I'm using gulp uncss. This is my task code: gulp.task('uncss', () => { return gulp.src($uncss.src) .pipe(uncss({ html: JSON.parse(require('fs').readFileSync('./sitemap.json', 'utf-8')), ignore: [/\.no-\w+/g, /\.is-\w+/g,…
magicspon
  • 926
  • 2
  • 9
  • 28
0
votes
0 answers

How to incorporate gulp-uncss with yeoman generator gulp-webapp

I included gulp-uncss: var uncss = require('gulp-uncss'); Then I added its function to the styles task: gulp.task('styles', () => { return gulp.src('app/styles/*.scss') .pipe($.plumber()) .pipe($.sourcemaps.init()) .pipe($.sass.sync({ …
scottrod
  • 477
  • 1
  • 8
  • 21
0
votes
0 answers

How to get the unclean CSS after gulp-uncss

I know I can get the clean CSS using gulp-uncss like so: var gulp = require('gulp'); var uncss = require('gulp-uncss'); var rename = require('gulp-rename'); gulp.task('clean-my-css', function() { return gulp.src('original.css') …
ObiHill
  • 11,448
  • 20
  • 86
  • 135
1
2