brunch-config.coffee 2.27 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13
module.exports = config:

  conventions:
    assets: /^src\/assets/
    ignored: ['hooks', 'plugins', 'resources', 'www']

  paths:
    public: 'www'
    watched: ['src']

  files:
    javascripts:
      joinTo:
14 15 16 17 18 19 20 21 22 23 24 25
        'angular.js': /^node_modules\/@angular/,
        'ionic.js': /^node_modules\/(@ionic|ionic-angular)/,
        'types.js': /^node_modules\/@types/,
        'crypto.js': /^node_modules\/(tweet|scrypt)/,
        'vendor.js': (path) ->
          path.startsWith('node_modules') &&
          !path.startsWith('node_modules/@angular') &&
          !path.startsWith('node_modules/@ionic') &&
          !path.startsWith('node_modules/ionic') &&
          !path.startsWith('node_modules/@types') &&
          !path.startsWith('node_modules/tweet') &&
          !path.startsWith('node_modules/scrypt')
26 27 28 29 30 31 32 33 34
        'main.js': /^src/
      order:
        after: [/\.html$/, /\.css$/]
    stylesheets:
      joinTo:
        'app.css': /(s?css)$/
    templates: joinTo: 'templates.js'

  plugins:
35 36 37 38
    uglify:
      mangle: true
      compress: true
      ignored: /main\.js/
39 40 41 42 43 44 45 46 47 48
    inlineCss: {
      html: true
    },
    babel:
      presets: ['es2015','stage-0']
    brunchTypescript: {
      ignoreErrors: true
    },
    copycat: {
      "fonts" : ["node_modules/ionic-angular/fonts"],
49

50 51 52 53 54 55 56 57
      verbose : false,
      onlyChanged: true
    }

  hooks:
    preCompile: () ->
      console.log("Pre-compilation: generation de ionic.css...")
      sass = require('node-sass');
58 59 60
      fs = require('fs')
      if (!fs.existsSync('www'))
        fs.mkdirSync('www')
61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85
      return new Promise((res, rej) ->
        sass.render({
          data: '$font-path: "/fonts"; @import "ionic.build.default";',
          outFile: 'www/ionic.css',
          sourceMap: true,
          includePaths: [
            "node_modules/ionic-angular/themes",
            "node_modules/ionic-angular/fonts",
            "node_modules/ionicons/dist/scss"
          ]
        }, (err, result) ->
          if (err)
            return rej(err)
          require('fs').writeFileSync('www/ionic.css',     result.css.toString('utf8'))
          require('fs').writeFileSync('www/ionic.css.map', result.map.toString('utf8'))
          return res()
        );
      )

  overrides:
    production:
      sourceMaps: true

  server:
    hostname: '127.0.0.1'