// *****************************************************************
// Ox - A modular framework for developing templated, responsive, grid-based projects.
//
// *****************************************************************

// Project configuration
var project     = 'ox'                    // Directory name for your project.
  , src         = './src/'                // The raw files for your project.
  , build       = './build/'              // The temporary files of your development build.
  , dist        = './dist/'               // The production package that you'll upload to your server.
  , assets      = 'assets/'               // The assets folder.
  , bower       = './bower_components/'   // Bower packages.
  , modules     = './node_modules/'       // npm packages.
;

// Project settings
module.exports = {

  browsersync: {
    files: [build+'/**', '!'+build+'/**.map'] // Watch all files, except map files
  , notify: false                             // In-line notifications
  , open: false                               // Stops the browser window opening automatically
  , port: 1337                                // Port number for the live version of the site; default: 1377
  , server: { baseDir: build }
  //, proxy: project+'.dev'                   // Proxy defined to work with Virtual Hosts
  , watchOptions: {
      debounceDelay: 2000                     // Avoid triggering too many reloads
    }
  },

  images: {
    build: {                                  // Copies images from `src` to `build`; does not optimise
      src: src+'**/*.+(png|jpg|jpeg|gif|svg)'
    , dest: build
    }
  , dist: {                                   // Optimises images in the `dist` folder
      src: [dist+'**/*.+(png|jpg|jpeg|gif|svg)']
    , imagemin: {
        optimizationLevel: 7
      , progressive: true
      , interlaced: true
      }
    , dest: dist
    }
  },

    , jquery: ['jquery']
    , modernizr: ['modernizr']
    }
  , chunks: {                               // Chunks are arrays of paths or globs matching a set of source files
      core: src+assets+'js/core/*.js'
    , vendor: src+assets+'js/vendor/*.js'
    , modernizr: src+assets+'js/modernizr/*.js'
    , jquery: bower+'jquery/dist/jquery.js'
    }
  , dest: build+assets+'js/'
  , lint: {
      src: [src+assets+'js/**/*.js', '!'+src+assets+'js/vendor/*.js', '!'+src+assets+'js/modernizr/*.js']
    }
  , minify: {
      src: build+assets+'js/**/*.js'
    , uglify: {} // Default options
    , dest: build+assets+'js/'
    }
  },

  styles: {
    build: {
      src: src+assets+'scss/**/*.scss'
    , dest: build+assets+'/styles'
    }
  , autoprefixer: {
      browsers: ['> 1%', 'last 2 versions', 'ie 11', 'ios >= 6', 'android >= 4', 'safari >= 8']
    , grid: true
    }
  , stylelint: {"rules": {
      "color-no-invalid-hex": true,
      "number-leading-zero": "always",
      "number-no-trailing-zeros": true,
      "length-zero-no-unit": true,
      "string-quotes": "double",
      "value-no-vendor-prefix": true,
      "declaration-colon-space-before": "never",
      "declaration-bang-space-before": "always",
      "declaration-bang-space-after": "never",
      "declaration-block-semicolon-newline-after": "always-multi-line",
      "selector-list-comma-space-before": "never",
      "selector-pseudo-element-colon-notation": "double",
      "max-empty-lines": 5
    }}
  , minify: {
      safe: true,
      autoprefixer: false
  }
  , libsass: { // Requires the libsass implementation of Sass
      includePaths: [src+assets+'scss', bower, modules]
    , precision: 6
    }
  },

  theme: {
    beautify: {
      "indent_size": 4,
      "indent_with_tabs": true,
      "max_preserve_newlines": 1
    }
  , njk: {
      src: src+'app/pages/**/*.+(html|njk|json)'
    , path: [src+'app/templates']
    , dest: build
    }
  , html: {
      src: src+'**/*.html'
    , dest: build
    }
  , favicon: {
      src: src+assets+'images/favicon/*.+(ico|jpg|json)'
    , dest: build+assets+'images'
    }
  , font: {
      src: src+assets+'fonts/**/*.+(eot|svg|ttf|woff|woff2)'
    , dest: build+assets+'fonts'
    }
  },

  utils: {
    clean: [build+'**/.DS_Store']
  , wipe: [dist]
  , dist: {
      src: [build+'**/*', '!'+build+'**/*.map']
    , dest: dist
    }
  },

  watch: {
    src: {
      styles:       src+assets+'scss/**/*.scss'
    , scripts:      src+assets+'js/**/*.js'
    , images:       src+'**/*.+(png|jpg|jpeg|gif|svg)'
    , theme:        src+'**/*.+(html|njk|json)'
    , themeassets:  [src+assets+'images/favicon/*.+(ico|jpg|json)', src+assets+'fonts/**/*.+(eot|svg|ttf|woff|woff2)']
    }
  , watcher: 'browsersync'
  }
}
 scripts: {
    bundles: {                              // Bundles are defined by a name and an array of chunks (below) to concatenate.
      core: ['core']
    , vendor: ['vendor']