Mon Jul 16 2018
Copied to clipboard! Copy reply
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
  • 16
  • 17
  • 18
  • 19
  • 20
  • 21
  • 22
  • 23
  • 24
  • 25
  • 26
  • 27
  • 28
  • 29
  • 30
  • 31
  • 32
  • 33
  • 34
  • 35
  • 36
  • 37
  • 38
  • 39
  • 40
  • 41
  • 42
  • 43
  • 44
  • 45
  • 46
  • 47
  • 48
  • 49
  • 50
  • 51
  • 52
  • 53
  • 54
  • 55
  • 56
const fs = require('fs')
const _ = require('lodash') 

// Underscore is only needed for intersect fn
// Once flatMap is supported, remove it.


module.exports = {

  // Config for `nuxt generate`
  generate: {
    routes ()
    {
      /*
       * `models[]` must be an array of `template/page` elements.
       * we get templates by scanning the local `pages/lp/` directory,
       * and
       */
      const templates = fs.readdirSync(__dirname + '/pages/lp/')
      var models = ['sitewide', 'rmsitewide', 'sale'] // This would come from AirTable
      models = _.flatMapDeep(templates.map(t => models.map(m => `/lp/${t}/${m}`)))

      return models
    }


   
  },
  
  router: {
    base: '/lp/' // for static assets. maybe create lp/ inside static/
  },

  /*
  ** Build configuration
  */ 
  build: {
    // Run ESLint on save
    extend (config, { isDev, isClient }) {
      if (isDev && isClient) {
        config.module.rules.push({
          enforce: 'pre',
          test: /\.(js|vue)$/,
          loader: 'eslint-loader',
          exclude: /(node_modules)/
        },{
          test: /\.css$/,
          use: [
            'vue-style-loader',
            'css-loader'
          ],
        },)
      }
    }
  }
}