source: tanzpartie-hugo/themes/bilberry-hugo-theme/webpack.mix.js @ 17929

Last change on this file since 17929 was 16971, checked in by Henrik Bettermann, 2 years ago
File size: 3.5 KB
Line 
1let mix = require('laravel-mix');
2
3/*
4 |--------------------------------------------------------------------------
5 | Mix Asset Management
6 |--------------------------------------------------------------------------
7 |
8 | Mix provides a clean, fluent API for defining some Webpack build steps
9 | for your Laravel application. By default, we are compiling the Sass
10 | file for your application, as well as bundling up your JS files.
11 |
12 */
13mix.autoload({
14  jquery: ['$', 'window.jQuery', 'jQuery'],
15  moment: 'moment'
16});
17
18mix.setPublicPath('./static')
19.setResourceRoot('./')
20.js('assets/js/theme.js', './')
21.sass('assets/sass/theme.scss', './')
22.then(() => {
23  const fs = require("fs");
24  const oldFontsPath = './static/fonts/vendor';
25  const newFontsPath = './static/fonts/_vendor';
26  const themeFile = './static/theme.css';
27
28  if (fs.existsSync(newFontsPath)) {
29    fs.rmdirSync(newFontsPath, {recursive: true, force: true});
30  }
31
32  fs.rename(oldFontsPath, newFontsPath, function (err) {
33    if (err) {
34      console.log(err)
35    }
36  })
37
38  fs.readFile(themeFile, 'utf8', function (err, data) {
39    if (err) {
40      return console.log(err);
41    }
42    let result = data.replace(/vendor/g, '_vendor');
43
44    fs.writeFile(themeFile, result, 'utf8', function (err) {
45      if (err) {
46        return console.log(err);
47      }
48    });
49  });
50});
51
52// Full API
53// mix.js(src, output);
54// mix.react(src, output); <-- Identical to mix.js(), but registers React Babel compilation.
55// mix.preact(src, output); <-- Identical to mix.js(), but registers Preact compilation.
56// mix.coffee(src, output); <-- Identical to mix.js(), but registers CoffeeScript compilation.
57// mix.ts(src, output); <-- TypeScript support. Requires tsconfig.json to exist in the same folder as webpack.mix.js
58// mix.extract(vendorLibs);
59// mix.sass(src, output);
60// mix.less(src, output);
61// mix.stylus(src, output);
62// mix.postCss(src, output, [require('postcss-some-plugin')()]);
63// mix.browserSync('my-site.test');
64// mix.combine(files, destination);
65// mix.babel(files, destination); <-- Identical to mix.combine(), but also includes Babel compilation.
66// mix.copy(from, to);
67// mix.copyDirectory(fromDir, toDir);
68// mix.minify(file);
69// mix.sourceMaps(); // Enable sourcemaps
70// mix.version(); // Enable versioning.
71// mix.disableNotifications();
72// mix.setPublicPath('path/to/public');
73// mix.setResourceRoot('prefix/for/resource/locators');
74// mix.autoload({}); <-- Will be passed to Webpack's ProvidePlugin.
75// mix.webpackConfig({}); <-- Override webpack.config.js, without editing the file directly.
76// mix.babelConfig({}); <-- Merge extra Babel configuration (plugins, etc.) with Mix's default.
77// mix.then(function () {}) <-- Will be triggered each time Webpack finishes building.
78// mix.override(function (webpackConfig) {}) <-- Will be triggered once the webpack config object has been fully generated by Mix.
79// mix.dump(); <-- Dump the generated webpack config object to the console.
80// mix.extend(name, handler) <-- Extend Mix's API with your own components.
81// mix.options({
82//   extractVueStyles: false, // Extract .vue component styling to file, rather than inline.
83//   globalVueStyles: file, // Variables file to be imported in every component.
84//   processCssUrls: true, // Process/optimize relative stylesheet url()'s. Set to false, if you don't want them touched.
85//   purifyCss: false, // Remove unused CSS selectors.
86//   terser: {}, // Terser-specific options. https://github.com/webpack-contrib/terser-webpack-plugin#options
87//   postCss: [] // Post-CSS options: https://github.com/postcss/postcss/blob/master/docs/plugins.md
88// });
Note: See TracBrowser for help on using the repository browser.