webpack.config.js 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119
  1. var Encore = require('@symfony/webpack-encore');
  2. const CopyWebpackPlugin = require('copy-webpack-plugin');
  3. const FileManagerPlugin = require('filemanager-webpack-plugin');
  4. Encore
  5. .setOutputPath('public/build/')
  6. .setManifestKeyPrefix('public/build/')
  7. .setPublicPath('../')
  8. .cleanupOutputBeforeBuild()
  9. .addEntry('app', './assets/js/app.js')
  10. .addEntry('bootstrap', './assets/js/bootstrap.js')
  11. .addEntry('exercise', './assets/js/exercise.js')
  12. .addEntry('free-jqgrid', './assets/js/free-jqgrid.js')
  13. .addStyleEntry('css/app', './assets/css/app.scss')
  14. .addStyleEntry('css/bootstrap', './assets/css/bootstrap.scss')
  15. .addStyleEntry('css/chat', './assets/css/chat.css')
  16. .addStyleEntry('css/document', './assets/css/document.css')
  17. .addStyleEntry('css/editor', './assets/css/editor.css')
  18. .addStyleEntry('css/editor_content', './assets/css/editor_content.css')
  19. .addStyleEntry('css/markdown', './assets/css/markdown.css')
  20. .addStyleEntry('css/print', './assets/css/print.css')
  21. .addStyleEntry('css/responsive', './assets/css/responsive.css')
  22. .addStyleEntry('css/scorm', './assets/css/scorm.css')
  23. .enableSingleRuntimeChunk()
  24. .enableSourceMaps(!Encore.isProduction())
  25. // .enableVersioning(Encore.isProduction())
  26. .enableSassLoader()
  27. .enableVueLoader()
  28. .autoProvidejQuery()
  29. .copyFiles([
  30. {
  31. from: './node_modules/multiselect-two-sides/dist/js',
  32. pattern: /(multiselect.js)$/,
  33. to: 'libs/multiselect-two-sides/dist/js/multiselect.js'
  34. },
  35. {
  36. from: './node_modules/pwstrength-bootstrap/dist/',
  37. pattern: /(pwstrength-bootstrap.js)$/,
  38. to: 'libs/pwstrength-bootstrap/dist/pwstrength-bootstrap.js'
  39. },
  40. {
  41. from: './node_modules/readmore-js',
  42. pattern: /(readmore.js)$/,
  43. to: 'libs/readmore-js/readmore.js'
  44. },
  45. {
  46. from: './node_modules/js-cookie/src/',
  47. pattern: /(js.cookie.js)$/,
  48. to: 'libs/js-cookie/src/js.cookie.js'
  49. },
  50. {
  51. from: './node_modules/mathjax/',
  52. pattern: /(MathJax.js)$/,
  53. to: 'libs/mathjax/MathJax.js'
  54. },
  55. ])
  56. ;
  57. Encore.addPlugin(new CopyWebpackPlugin([
  58. {
  59. from: './node_modules/mediaelement/build',
  60. to: 'libs/mediaelement'
  61. },
  62. {
  63. from: './node_modules/mediaelement-plugins/dist',
  64. to: 'libs/mediaelement/plugins'
  65. },
  66. {
  67. from: './node_modules/mathjax/config',
  68. to: 'libs/mathjax/config'
  69. },
  70. ]));
  71. // Encore.addPlugin(new copyWebpackPlugin([{
  72. // from: 'assets/css/themes/' + theme + '/images',
  73. // to: 'css/themes/' + theme + '/images'
  74. // };
  75. var themes = [
  76. 'chamilo'
  77. ];
  78. // Add Chamilo themes
  79. themes.forEach(function (theme) {
  80. Encore.addStyleEntry('css/themes/' + theme + '/default', './assets/css/themes/' + theme + '/default.css');
  81. // Copy images from themes into public/build
  82. Encore.addPlugin(new CopyWebpackPlugin([{
  83. from: 'assets/css/themes/' + theme + '/images',
  84. to: 'css/themes/' + theme + '/images'
  85. },
  86. ]));
  87. });
  88. // Fix free-jqgrid languages files
  89. Encore.addPlugin(new FileManagerPlugin({
  90. onEnd: {
  91. move: [
  92. {
  93. source: './public/public/build/free-jqgrid/',
  94. destination: './public/build/free-jqgrid/'
  95. }
  96. ],
  97. delete: [
  98. './public/public/'
  99. ]
  100. }
  101. }));
  102. module.exports = Encore.getWebpackConfig();