2013-06-05 10:24:52 +02:00
|
|
|
/**!
|
2013-07-07 17:27:56 +02:00
|
|
|
* Cppcheck - A tool for static C/C++ code analysis
|
|
|
|
* Copyright (C) 2013 XhmikosR and Cppcheck team.
|
2013-06-05 10:24:52 +02:00
|
|
|
*
|
2013-07-07 17:27:56 +02:00
|
|
|
* This program is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU General Public License as published by
|
|
|
|
* the Free Software Foundation, either version 3 of the License, or
|
|
|
|
* (at your option) any later version.
|
2013-06-05 10:24:52 +02:00
|
|
|
*
|
2013-07-07 17:27:56 +02:00
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2013-06-05 10:24:52 +02:00
|
|
|
*/
|
|
|
|
|
|
|
|
(function () {
|
2013-07-28 10:20:59 +02:00
|
|
|
"use strict";
|
2013-06-05 10:24:52 +02:00
|
|
|
|
2013-07-28 10:20:59 +02:00
|
|
|
require("shelljs/make");
|
|
|
|
var fs = require("fs"),
|
|
|
|
cleanCSS = require("clean-css"),
|
|
|
|
UglifyJS = require("uglify-js"),
|
|
|
|
ROOT_DIR = __dirname + "/"; // absolute path to project's root
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// make minify
|
|
|
|
//
|
|
|
|
target.minify = function () {
|
|
|
|
cd(ROOT_DIR);
|
|
|
|
echo();
|
|
|
|
echo("### Minifying css files...");
|
|
|
|
|
|
|
|
// pack.css
|
|
|
|
|
2013-07-28 10:20:59 +02:00
|
|
|
var inCss = cat(["css/all.css",
|
|
|
|
"css/demo.css",
|
|
|
|
"css/normalize.css"
|
2013-06-05 10:24:52 +02:00
|
|
|
]);
|
|
|
|
|
|
|
|
var packCss = cleanCSS.process(inCss, {
|
|
|
|
removeEmpty: true,
|
|
|
|
keepSpecialComments: 0
|
|
|
|
});
|
|
|
|
|
2013-07-28 10:20:59 +02:00
|
|
|
fs.writeFileSync("css/pack.css", packCss, "utf8");
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
echo();
|
2013-07-28 17:22:01 +02:00
|
|
|
echo("### Finished css/pack.css.");
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
echo();
|
|
|
|
echo("### Minifying js files...");
|
|
|
|
|
2013-07-28 10:20:59 +02:00
|
|
|
var inJs = cat(["js/github.js",
|
|
|
|
"js/picnet.table.filter.min.js"]);
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
var minifiedJs = UglifyJS.minify(inJs, {
|
|
|
|
compress: true,
|
|
|
|
fromString: true, // this is needed to pass JS source code instead of filenames
|
|
|
|
mangle: true,
|
|
|
|
warnings: false
|
|
|
|
});
|
|
|
|
|
2013-07-28 10:20:59 +02:00
|
|
|
fs.writeFileSync("js/pack.js", minifiedJs.code, "utf8");
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
echo();
|
2013-07-28 17:22:01 +02:00
|
|
|
echo("### Finished js/pack.js.");
|
2013-06-05 10:24:52 +02:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
//
|
|
|
|
// make all
|
|
|
|
//
|
|
|
|
target.all = function () {
|
|
|
|
target.minify();
|
|
|
|
};
|
|
|
|
|
|
|
|
//
|
|
|
|
// make help
|
|
|
|
//
|
|
|
|
target.help = function () {
|
|
|
|
echo("Available targets:");
|
|
|
|
echo(" minify Creates the minified CSS and JS");
|
|
|
|
echo(" help shows this help message");
|
|
|
|
};
|
|
|
|
|
|
|
|
}());
|