build css in development

This commit is contained in:
Kushan Joshi
2017-09-21 17:53:25 +05:30
parent f42cb77d99
commit 24fef3cbac
2 changed files with 28 additions and 5 deletions

View File

@@ -8,11 +8,33 @@ var json = require('rollup-plugin-json');
var http = require('http');
var gaze = require('gaze');
var ecstatic = require('ecstatic');
var glob = require('glob');
var concat = require('concat-files');
function makeCSS() {
glob('css/**/*.css', function (er, files) {
if (er) console.error(er);
concat(files, 'dist/iD.css', function (err) {
if (err) console.error(err);
console.log('css built');
});
});
}
var building = false;
var cache;
if (process.argv[2] === 'develop') {
var isDevelopment = process.argv[2] === 'develop';
if (isDevelopment) {
build();
makeCSS();
gaze(['css/**/*.css'], function(err, watcher) {
watcher.on('all', function() {
makeCSS();
});
});
gaze(['modules/**/*.js', 'data/**/*.{js,json}'], function(err, watcher) {
watcher.on('all', function() {
@@ -28,6 +50,7 @@ if (process.argv[2] === 'develop') {
} else {
build();
makeCSS();
}

View File

@@ -14,7 +14,6 @@
"build": "node build.js && node development_server.js",
"clean": "shx rm -f dist/*.js dist/*.map dist/*.css dist/img/*.svg",
"dist": "npm-run-all -p dist:**",
"dist:css": "shx cat css/*.css > dist/iD.css",
"dist:mapillary": "shx mkdir -p dist/mapillary-js && shx cp -R node_modules/mapillary-js/dist/* dist/mapillary-js/",
"dist:min": "uglifyjs dist/iD.js -c warnings=false -m -o dist/iD.min.js",
"dist:svg:maki": "svg-sprite --symbol --symbol-dest . --symbol-sprite dist/img/maki-sprite.svg node_modules/@mapbox/maki/icons/*.svg",
@@ -37,19 +36,20 @@
"wmf-sitematrix": "0.1.4"
},
"devDependencies": {
"@mapbox/maki": "^4.0.0",
"brfs": "1.4.3",
"chai": "^4.1.0",
"concat-files": "^0.1.1",
"d3": "4.10.2",
"ecstatic": "^3.0.0",
"editor-layer-index": "osmlab/editor-layer-index.git#gh-pages",
"gaze": "^1.1.1",
"eslint": "^4.3.0",
"gaze": "^1.1.1",
"glob": "^7.1.0",
"happen": "^0.3.1",
"js-yaml": "^3.9.0",
"jsonschema": "^1.1.0",
"json-stable-stringify": "^1.0.1",
"@mapbox/maki": "^4.0.0",
"jsonschema": "^1.1.0",
"mapillary-js": "2.8.0",
"minimist": "^1.2.0",
"mocha": "^3.4.0",