-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.mix.js
128 lines (103 loc) · 3.01 KB
/
webpack.mix.js
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
// webpack.mix.js
// Grabs the package.json file to use our site’s environment/values
const pkg = require("./package.json");
let mix = require('laravel-mix');
const baseUrl = 'https://html-starter.ddev.site';
const moment = require("moment");
// Laravel Mix plugins for additional capabilities
// require("laravel-mix-purgecss");
require("laravel-mix-banner");
// html builder for includes
require('mix-html-builder');
// CSS Plugins
const tailwindJit = require("@tailwindcss/jit");
const tailwindcss = require("tailwindcss");
const autoprefixer = require("autoprefixer");
const presetenv = require("postcss-preset-env");
const hexrgba = require('postcss-hexrgba');
// Image plugins for compression from src folder
const ImageminPlugin = require("imagemin-webpack-plugin").default;
const CopyWebpackPlugin = require("copy-webpack-plugin");
const imageminMozjpeg = require("imagemin-mozjpeg");
mix
.setPublicPath('./public/assets/')
.html({
htmlRoot: './src/html/*.html', // Your html root file(s)
output: '../', // The html output folder
partialRoot: './src/html/partials', // default partial path
layoutRoot: './src/html/layouts', // default partial path
minify: {
removeComments: false
}
})
.postCss("./src/css/app.css", "css")
.options({
postCss: [
tailwindJit,
],
autoprefixer: {
options: {
browsers: [
'last 4 versions',
]
}
},
processCssUrls: false,
hmrOptions: {
host: baseUrl,
port: 8080
},
devtool: 'eval-cheap-module-source-map'
})
// Source maps disabled (temporarily?) to improve build time
.sourceMaps()
// combine all our js scripts here
// when npm run production is run will minimize as well
.js(
[
// './node_modules/flickity/dist/flickity.pkgd.min.js',
// './node_modules/swiper/swiper-bundle.min.js',
// this should go last
'./src/js/app.js'
],
'public/assets/js/scripts.combined.js')
// combine all our vendor css files here
.combine(
[
// './node_modules/flickity/dist/flickity.min.css',
// './node_modules/swiper/swiper-bundle.min.css'
],
'public/assets/css/vendor.combined.css')
.banner({
banner: (function () {
return [
'/**!',
' * @project Caffeine Creations Website',
' * @author Sean Smith, Caffeine Creations <[email protected]>',
' * @Copyright Copyright (c) ' + moment().format("YYYY") + ', Caffeine Creations',
' *',
' */',
'',
].join('\n');
})(),
raw: true,
})
.browserSync({
proxy: baseUrl,
ghostMode: false,
notify: {
styles: {
top: 'auto',
bottom: '1rem'
}
},
files: ["src/css/*.css","src/js/*.js", "src/html/**/*.html", "src/html/*.html", "src/*.js", "src/**/*.js"]
});
mix.disableSuccessNotifications();
// production
if (mix.inProduction()) {
// copy fonts
mix.copyDirectory('./src/fonts/', './public/assets/fonts/')
mix.version();
}
// end production