config.js 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. import process from 'process';
  2. import args from 'yargs';
  3. /**
  4. * Configuration for the build process
  5. *
  6. * Distinction of development and production builds is made by user-provided node environment variable
  7. * By default, the development target will be built
  8. *
  9. * development: `gulp ...`
  10. * production: `NODE_ENV=production gulp ...`
  11. *
  12. * Additionally, if the web app has access to an API, the distinction between 'online' and 'offline' modes is made by user-provided command line argument
  13. * If no argument is given, the 'online' version will be built
  14. *
  15. * development / offline: `gulp --api-mode=offline`
  16. */
  17. export default {
  18. currentTarget: process.env.NODE_ENV || 'development',
  19. currentMode: args.argv.apiMode || 'online',
  20. targets: {
  21. development: {
  22. delimiter: '',
  23. infix: ''
  24. },
  25. production: {
  26. delimiter: '.',
  27. infix: 'min'
  28. }
  29. },
  30. modes: {
  31. offline: {
  32. delimiter: '-',
  33. infix: 'offline'
  34. },
  35. online: {
  36. delimiter: '',
  37. infix: ''
  38. }
  39. },
  40. // .eslintcr.yml is not being read?
  41. eslint: {
  42. development: {
  43. rules: {
  44. 'no-console': 0,
  45. 'no-warning-comments': 0
  46. },
  47. plugins: [ 'react' ]
  48. },
  49. production: {
  50. rules: {
  51. 'no-console': 1,
  52. 'no-warning-comments': [ 1, { terms: [ 'todo', 'fixme' ], location: 'start' } ]
  53. },
  54. plugins: [ 'react' ]
  55. }
  56. },
  57. // htmlhint configuration
  58. htmlhintrc: '.htmlhintrc',
  59. // gulp-sass configuration
  60. sass: {
  61. development: {
  62. outputStyle: 'nested'
  63. },
  64. production: {
  65. outputStyle: 'nested',
  66. sourceMap: false
  67. }
  68. },
  69. fileNames: {
  70. css: 'main',
  71. html: 'index',
  72. js: 'main',
  73. jsx: 'main'
  74. },
  75. paths: {
  76. src: 'src',
  77. dest: 'public',
  78. assets: 'assets',
  79. css: 'css',
  80. fonts: 'fonts',
  81. html: 'html',
  82. js: 'js',
  83. images: 'img',
  84. sass: 'scss',
  85. sprites: 'sprites'
  86. },
  87. // browsersync configuration
  88. server: {
  89. baseDir: './public/',
  90. index: 'index.html'
  91. },
  92. logLevel: 'silent'
  93. };