@pushword/js-helper 0.0.51 → 0.0.55
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -1
- package/src/encore.js +92 -0
- package/src/tailwind.config.js +35 -0
- package/src/tailwind.helpers.js +17 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pushword/js-helper",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.55",
|
|
4
4
|
"description": "Pushword front end helpers. ",
|
|
5
5
|
"author": "Robin@PiedWeb <contact@piedweb.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
"@tailwindcss/aspect-ratio": "^0.2",
|
|
14
14
|
"@tailwindcss/forms": "^0.4",
|
|
15
15
|
"@tailwindcss/typography": "^0.5",
|
|
16
|
+
"tailwindcss-multi-column": "^1.0.2",
|
|
16
17
|
"ace-builds": "^1.4.12",
|
|
17
18
|
"autoprefixer": "^10.1.0",
|
|
18
19
|
"babel-preset-stage-2": "^6.24.1",
|
package/src/encore.js
ADDED
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
const WatchExternalFilesPlugin = require("webpack-watch-files-plugin").default;
|
|
2
|
+
const Encore = require("@symfony/webpack-encore");
|
|
3
|
+
const tailwindcss = require("tailwindcss");
|
|
4
|
+
|
|
5
|
+
function getFilesToWatch() {
|
|
6
|
+
return [
|
|
7
|
+
"./../vendor/pushword/core/src/templates/**/*.html.twig",
|
|
8
|
+
"./../vendor/pushword/core/src/templates/*.html.twig",
|
|
9
|
+
"./../vendor/pushword/conversation/src/templates/*.html.twig",
|
|
10
|
+
"./../vendor/pushword/admin-block-editor/src/templates/page/*.html.twig",
|
|
11
|
+
"./../templates/*.html.twig",
|
|
12
|
+
"./../templates/**/*.html.twig",
|
|
13
|
+
"./../templates/**/**/*.html.twig",
|
|
14
|
+
];
|
|
15
|
+
}
|
|
16
|
+
function getTailwindConfig(watchFiles = null) {
|
|
17
|
+
if (watchFiles === null) watchFiles = getFilesToWatch();
|
|
18
|
+
var tailwindConfig = require("@pushword/js-helper/src/tailwind.config.js");
|
|
19
|
+
tailwindConfig.content = watchFiles;
|
|
20
|
+
return tailwindConfig;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
module.exports = {
|
|
24
|
+
getFilesToWatch: getFilesToWatch,
|
|
25
|
+
getTailwindConfig: getTailwindConfig,
|
|
26
|
+
getEncore: function (
|
|
27
|
+
watchFiles = null,
|
|
28
|
+
tailwindConfig = null,
|
|
29
|
+
outputPath = "./../public/assets/",
|
|
30
|
+
publicPath = "/assets",
|
|
31
|
+
manifestKeyPrefix = null,
|
|
32
|
+
filesToCopy = [
|
|
33
|
+
{
|
|
34
|
+
from: "./media/", // todo explain
|
|
35
|
+
to: "[name].[ext]",
|
|
36
|
+
pattern: /svg$/,
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
from: "./img/",
|
|
40
|
+
to: "[name].[ext]",
|
|
41
|
+
pattern: /header.jpg$/,
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
from: "./favicons",
|
|
45
|
+
to: "[name].[ext]",
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
entries = [{ name: "app", file: "./app.js" }],
|
|
49
|
+
styleEntries = [{ name: "style", file: "./app.css" }]
|
|
50
|
+
) {
|
|
51
|
+
if (watchFiles === null) {
|
|
52
|
+
watchFiles = getFilesToWatch();
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if (tailwindConfig === null) {
|
|
56
|
+
tailwindConfig = getTailwindConfig(watchFiles);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
Encore.setOutputPath(outputPath)
|
|
60
|
+
.setPublicPath(publicPath)
|
|
61
|
+
.cleanupOutputBeforeBuild()
|
|
62
|
+
.enableSassLoader()
|
|
63
|
+
.enableSourceMaps(false)
|
|
64
|
+
.enableVersioning(false)
|
|
65
|
+
.addPlugin(
|
|
66
|
+
new WatchExternalFilesPlugin({
|
|
67
|
+
files: watchFiles,
|
|
68
|
+
})
|
|
69
|
+
)
|
|
70
|
+
.enablePostCssLoader((options) => {
|
|
71
|
+
options.postcssOptions = {
|
|
72
|
+
plugins: [require("postcss-import"), tailwindcss(tailwindConfig), require("autoprefixer")],
|
|
73
|
+
};
|
|
74
|
+
})
|
|
75
|
+
.disableSingleRuntimeChunk();
|
|
76
|
+
filesToCopy.forEach(function (toCopy) {
|
|
77
|
+
Encore.copyFiles(toCopy);
|
|
78
|
+
});
|
|
79
|
+
|
|
80
|
+
if (manifestKeyPrefix !== null) Encore.setManifestKeyPrefix(manifestKeyPrefix);
|
|
81
|
+
|
|
82
|
+
entries.forEach(function (entry) {
|
|
83
|
+
Encore.addEntry(entry.name, entry.file);
|
|
84
|
+
});
|
|
85
|
+
|
|
86
|
+
styleEntries.forEach(function (entry) {
|
|
87
|
+
Encore.addStyleEntry(entry.name, entry.file);
|
|
88
|
+
});
|
|
89
|
+
|
|
90
|
+
return Encore;
|
|
91
|
+
},
|
|
92
|
+
};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
const plugin = require("tailwindcss/plugin");
|
|
2
|
+
const pushwordHelper = require("@pushword/js-helper/src/tailwind.helpers.js");
|
|
3
|
+
|
|
4
|
+
module.exports = {
|
|
5
|
+
mode: "jit",
|
|
6
|
+
theme: {
|
|
7
|
+
minHeight: {
|
|
8
|
+
0: "0",
|
|
9
|
+
"screen-1/4": "25vh",
|
|
10
|
+
"screen-3/4": "75vh",
|
|
11
|
+
"screen-1/3": "33vh",
|
|
12
|
+
"screen-2/3": "66vh",
|
|
13
|
+
"screen-1/2": "50vh",
|
|
14
|
+
screen: "100vh",
|
|
15
|
+
full: "100%",
|
|
16
|
+
},
|
|
17
|
+
extend: {
|
|
18
|
+
typography: pushwordHelper.extendTailwindTypography(),
|
|
19
|
+
colors: {
|
|
20
|
+
primary: "var(--primary)",
|
|
21
|
+
secondary: "var(--secondary)",
|
|
22
|
+
},
|
|
23
|
+
},
|
|
24
|
+
},
|
|
25
|
+
variants: {},
|
|
26
|
+
plugins: [
|
|
27
|
+
require("tailwindcss-multi-column")(),
|
|
28
|
+
require("@tailwindcss/typography"),
|
|
29
|
+
require("@tailwindcss/aspect-ratio"),
|
|
30
|
+
require("@tailwindcss/forms"),
|
|
31
|
+
plugin(pushwordHelper.twFirstLetterPlugin),
|
|
32
|
+
plugin(pushwordHelper.twFirstChildPlugin),
|
|
33
|
+
plugin(pushwordHelper.twBleedPlugin),
|
|
34
|
+
],
|
|
35
|
+
};
|
package/src/tailwind.helpers.js
CHANGED
|
@@ -28,4 +28,21 @@ module.exports = {
|
|
|
28
28
|
});
|
|
29
29
|
});
|
|
30
30
|
},
|
|
31
|
+
twBleedPlugin: function ({ addUtilities }) {
|
|
32
|
+
addUtilities({
|
|
33
|
+
".bleed": {
|
|
34
|
+
width: "100vw",
|
|
35
|
+
"margin-inline-start": "50%",
|
|
36
|
+
"margin-inline-end": "unset",
|
|
37
|
+
transform: "translateX(-50%)",
|
|
38
|
+
"max-width": "none",
|
|
39
|
+
},
|
|
40
|
+
".bleed-disable": {
|
|
41
|
+
width: "inherit",
|
|
42
|
+
"margin-inline-start": "inherit",
|
|
43
|
+
"margin-inline-end": "inherit",
|
|
44
|
+
transform: "default",
|
|
45
|
+
},
|
|
46
|
+
});
|
|
47
|
+
},
|
|
31
48
|
};
|