build.js 703 B

12345678910111213141516171819202122232425
  1. var UglifyJS = require('uglify-js2'),
  2. sass = require('node-sass'),
  3. fs = require('fs')
  4. //SCSS Rendering
  5. fs.writeFileSync(__dirname + "/build/chatUI.css", sass.renderSync({
  6. data:fs.readFileSync(__dirname + "/src/css/style.scss", 'utf8'),
  7. outputStyle: 'compressed'
  8. }).css,
  9. 'utf8'
  10. )
  11. //JS Building
  12. let files = ['index-d3.js', 'index-jquery.js']
  13. files.forEach(function(file){
  14. let base = file.split('.'),
  15. min = UglifyJS.minify([__dirname + "/src/js/"+file], {
  16. outSourceMap: __dirname + '/build/' + base[0] + '.min.js.map',
  17. sourceRoot: "http://svift.xyz/src"
  18. })
  19. fs.writeFileSync(__dirname + "/build/" + base[0] + ".min.js", min.code, 'utf8')
  20. })
  21. console.log('build complete')