This repository was archived by the owner on Apr 16, 2025. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.mix.js
More file actions
74 lines (63 loc) · 1.47 KB
/
webpack.mix.js
File metadata and controls
74 lines (63 loc) · 1.47 KB
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
/**
* Dependencies
*/
const fs = require('fs')
const mix = require('laravel-mix')
// wordpress specific jsx
require('laravel-mix-wp-blocks')
/**
* Project configuration
*/
const namespace = 'copernicus'
const script = {
src: (name, file) => `resources/assets/scripts/${namespace}/${name}/${file}.js`,
pub: (name, file) => `dist/${namespace}/${name}/${file}.js`,
}
const style = {
src: (name, file) => `resources/assets/styles/${namespace}/${name}/${file}.scss`,
pub: (name, file) => `dist/${namespace}/${name}/${file}.css`,
}
const blocks = require('./blocks.json')
blocks.forEach(block => {
/**
* Editor script
*/
fs.existsSync(script.src(block, 'editor')) &&
mix.block(
script.src(block, 'editor'),
script.pub(block, 'editor'),
)
/**
* Public script
*/
fs.existsSync(script.src(block, 'public')) &&
mix.js(
script.src(block, 'public'),
script.pub(block, 'public'),
)
/**
* Public script with wp-element dependencies
*/
fs.existsSync(script.src(block, 'react')) &&
mix.block(
script.src(block, 'react'),
script.pub(block, 'react'),
)
/**
* Editor style
*/
fs.existsSync(style.src(block, 'editor')) &&
mix.sass(
style.src(block, 'editor'),
style.pub(block, 'editor')
)
/**
* Public style
*/
fs.existsSync(style.src(block, 'public')) &&
mix.sass(
style.src(block, 'public'),
style.pub(block, 'public')
)
})
mix.setPublicPath('./dist')