Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
});
//
// 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]);
// 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);
}
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
});
}
});
};
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;
}
var mincss = function(css) { return cleancss.process(css); };
var minjs = uglifyjs;
function compressCSS(values)
{
var complete = values.join("\n");
return cleanCSS.process(complete);
}
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 = '';
function minifyCss(str, asset, next) {
return next(null, cleanCSS.process(str));
}