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"),
|
2013-11-05 07:03:31 +01:00
|
|
|
CleanCSS = require("clean-css"),
|
2013-07-28 10:20:59 +02:00
|
|
|
UglifyJS = require("uglify-js"),
|
2013-09-23 07:01:06 +02:00
|
|
|
rootDir = __dirname + "/"; // absolute path to project's root
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
//
|
|
|
|
// make minify
|
|
|
|
//
|
|
|
|
target.minify = function () {
|
2013-09-23 07:01:06 +02:00
|
|
|
cd(rootDir);
|
2013-06-05 10:24:52 +02:00
|
|
|
echo();
|
|
|
|
echo("### Minifying css files...");
|
|
|
|
|
|
|
|
// pack.css
|
2013-08-20 06:40:04 +02:00
|
|
|
var inCss = cat(["site/css/normalize.css",
|
|
|
|
"site/css/all.css",
|
|
|
|
"site/css/demo.css"
|
2013-06-05 10:24:52 +02:00
|
|
|
]);
|
|
|
|
|
2013-11-05 07:03:31 +01:00
|
|
|
var minifier = new CleanCSS({
|
|
|
|
keepSpecialComments: 0,
|
2014-02-15 07:27:53 +01:00
|
|
|
compatibility: "ie8"
|
2013-11-05 07:03:31 +01:00
|
|
|
});
|
2013-06-05 10:24:52 +02:00
|
|
|
|
2013-11-05 07:03:31 +01:00
|
|
|
fs.writeFileSync("site/css/pack.css", minifier.minify(inCss), "utf8");
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
echo();
|
2013-08-20 06:40:04 +02:00
|
|
|
echo("### Finished site/css/pack.css.");
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
echo();
|
|
|
|
echo("### Minifying js files...");
|
|
|
|
|
2013-10-12 16:26:57 +02:00
|
|
|
var inJs = cat(["site/js/github.js",
|
2013-08-20 06:40:04 +02:00
|
|
|
"site/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-08-20 06:40:04 +02:00
|
|
|
fs.writeFileSync("site/js/pack.js", minifiedJs.code, "utf8");
|
2013-06-05 10:24:52 +02:00
|
|
|
|
|
|
|
echo();
|
2013-08-20 06:40:04 +02:00
|
|
|
echo("### Finished site/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");
|
|
|
|
};
|
|
|
|
|
|
|
|
}());
|