How to use the clean-css.process function in clean-css

To help you get started, we’ve selected a few clean-css examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github MrSwitch / jquery.form.js / src / _build.js View on Github external
});


//
// Build Files
//
var build = {
	"../README.md" : htmlToMarkDown(fs.readFileSync("../index.html", "utf8")),
	"../dist/jquery.form.js" : unminifedJS.join('\n'),
	"../dist/jquery.form.min.js" : minifedJS.join('\n'),
	"../dist/jquery.form.css" : styles.join('\n'),
	"../dist/jquery.form.min.css" : cleanCSS.process(styles.join('\n')),
	"../dist/jquery.editor.js" : fs.readFileSync("./jquery.editor.js", "utf8"),
	"../dist/jquery.editor.min.js" : UglifyJS.minify("./jquery.editor.js").code,
	"../dist/jquery.editor.css" : fs.readFileSync("./jquery.editor.css", "utf8"),
	"../dist/jquery.editor.min.css" : cleanCSS.process(fs.readFileSync("./jquery.editor.css").toString()),
	"../dist/jquery.predict.js" : fs.readFileSync("./jquery.predict.js", "utf8"),
	"../dist/jquery.predict.min.js" : UglifyJS.minify("./jquery.predict.js").code,
	"../dist/jquery.predict.css" : fs.readFileSync("./jquery.predict.css", "utf8"),
	"../dist/jquery.predict.min.css" : cleanCSS.process(fs.readFileSync("./jquery.predict.css").toString())
};

for(var x in build){
	(function(name,code){
		fs.writeFile( name, code, function(err) {
			if(err) {
				console.log(err);
			} else {
				console.log(name + " created!");
			}
		});
	})(x, build[x]);
github spmjs / grunt-cmd-transport / tasks / lib / css2js.js View on Github external
// if outside css modules, fileObj would be undefined
  // then dont add styleBox
  var opt = {};
  if (addStyleBox && fileObj) {
    // ex. arale/widget/1.0.0/ => arale-widget-1_0_0
    var styleId = unixy((options || {}).idleading || '')
      .replace(/\/$/, '')
      .replace(/\//g, '-')
      .replace(/\./g, '_');
    opt.prefix = ['.', styleId, ' '].join('');
  }

  code = css2str(code, opt);

  // remove comment and format
  code = cleancss.process(code, {
    keepSpecialComments: 0,
    removeEmpty: true
  });

  // transform css to js
  // spmjs/spm#581
  var template = 'function() {seajs.importStyle(\'%s\')}';
  return format(template, code);
}
github lrsjng / fquery / lib / plugins / cleancss / index.js View on Github external
return this.edit(function (blob) {

			try {
				blob.content = cleancss.process(blob.content, settings);

			} catch (err) {
				fQuery.Event.error({
					method: 'cleancss',
					message: 'failed',
					fquery: this,
					blob: blob,
					data: err
				});
			}
		});
	};
github mozbrick / brick / build / minify.js View on Github external
srcJsPath = path.join('component', name, 'src', name + '.js');
    }

    try {
        js = uglifyjs.minify(srcJsPath);
        fs.writeFileSync(jsPath, js.code);
    } catch (e) {
        p.reject(e);
        return p;
    }

    var cssPath = path.join(distDir, name + '.min.css');
    console.log(cssPath);
    try {
        css = fs.readFileSync(path.join('component', name, 'src', name + '.css')).toString();
        css = cleancss.process(css);
        fs.writeFileSync(cssPath, css);
    } catch (e) {
        p.reject(e);
        return p;
    }

    if (typeof js !== 'undefined' && typeof css !== 'undefined') {
        p.fulfill({css: css, js: js.code});
    } else {
        throw "missing resulting source";
    }
    return p;
}
github jacobrask / styledocco / cli.js View on Github external
var mincss = function(css) { return cleancss.process(css); };
var minjs = uglifyjs;
github ether / etherpad-lite / src / node / utils / Minify.js View on Github external
function compressCSS(values)
{
  var complete = values.join("\n");
  return cleanCSS.process(complete);
}
github army8735 / more / web / more.js View on Github external
exports.compress = function(src, agressive) {
		src = src || '';
		if(cleanCSS.process) {
			src = cleanCSS.process(src, {
				removeEmpty: true
			});
		}
		if(agressive) {
			src = compress.compress(src);
		}
		return src;
	};
	var localRoot = '';
github fgnass / express-jsdom / lib / assets.js View on Github external
function minifyCss(str, asset, next) {
  return next(null, cleanCSS.process(str));
}

clean-css

A well-tested CSS minifier

MIT
Latest version published 3 months ago

Package Health Score

91 / 100
Full package analysis