'use strict' const p = require('path') const fs = require('fs') const port = fs.existsSync(p.join(PWD, 'server/config/port.js')) ? require(p.join(PWD, 'server/config/port')) : 10000 module.exports = { browserSync: { browser: null, ghostMode: false, proxy: 'localhost:' + port, port: 1337, ui: { port: 1338 }, files: [ p.join(PWD, 'public/css/**/*.css'), p.join(PWD, 'public/js/**/*.js'), ] }, browserify: { suffix: true, debug: true, dest: p.join(PWD, 'public/js'), extensions: [ '.js', '.jsx', '.json' ], // PWD/node_modules is added so symlinked ridge does not break. used to // work without this in browserify 9 paths: [ p.join(PWD, 'node_modules'), p.join(PWD, 'modules') ], // outputs only need to be used if output names are different from entries. // Otherwise the entries array is copied into the outputs array. entries: [ 'src/app.js' ], src: p.join(PWD, 'src') }, less: { suffix: true, src: [ p.join(PWD, 'less/*.less'), ], dest: p.join(PWD, 'public/css'), autoprefixer: { browsers: [ 'safari >= 5', 'ie >= 8', 'ios >= 6', 'opera >= 12.1', 'firefox >= 17', 'chrome >= 30', 'android >= 4' ], cascade: true }, functions: require('./less/functions'), options: { paths: [ p.join(PWD, 'node_modules/spineless/less') ], } }, nodemon: { ext: 'js, marko', watch: [ 'server', 'src', ], ignore: [ '*.marko.js', // only watch marko files in src folders. 'src/**/*.js' ], script: fs.existsSync(p.join(PWD, 'package.json')) ? require(p.join(PWD, 'package.json')).main.replace(/^\./, PWD) : 'server/server.js', env: { BABEL_ENV: 'server', // what port you actually put into the browser... when using browser-sync // this will differ from the internal port used by express EXTERNAL_PORT: 1337, // needed to force debug to use colors despite tty.istty(0) being false, // which it is in a child process DEBUG_COLORS: true, // needed to force chalk to use when running gulp nodemon tasks. FORCE_COLOR: true, PWD, NODE_ENV: ENV, DEBUG: 'mypaper:*' } }, raster: { src: p.join(PWD, 'img/raster/**/*.{png,gif,jpg}'), dest: p.join(PWD, 'public/img') }, static: { src: p.join(PWD, 'static/**/*'), dest: p.join(PWD, 'public') }, svg: { src: p.join(PWD, 'img/svg/**/*.svg'), dest: p.join(PWD, 'public/img') }, tasks: { development: [ 'wipe', [ 'browserify', 'less', 'raster', 'static', 'svg' ], [ 'nodemon' ], [ 'watch', 'browser-sync' ] ], production: [ 'wipe', [ 'browserify', 'less', 'raster', 'static', 'svg' ]] }[ENV], watch: { less: p.join(PWD, 'less/**/*.less') }, wipe: { src: [ p.join(PWD, 'public') ] } }