parent
36d55283d2
commit
3e8421d8b7
|
@ -4,25 +4,26 @@ ARG NODE_ENV="production"
|
||||||
ARG SCULPIN_ENV="prod"
|
ARG SCULPIN_ENV="prod"
|
||||||
ENV NODE_ENV="${NODE_ENV}" \
|
ENV NODE_ENV="${NODE_ENV}" \
|
||||||
PATH="${PATH}:/node_modules/.bin" \
|
PATH="${PATH}:/node_modules/.bin" \
|
||||||
SCULPIN_ENV="${SCULPIN_ENV}"
|
SCULPIN_ENV="${SCULPIN_ENV}" \
|
||||||
|
USER="node"
|
||||||
|
|
||||||
RUN apk add --no-cache bash
|
RUN apk add --no-cache bash
|
||||||
|
|
||||||
WORKDIR /app
|
WORKDIR /app/assets
|
||||||
|
|
||||||
RUN mkdir -p /node_modules \
|
RUN mkdir -p /node_modules \
|
||||||
&& chown node:node -R /app /node_modules
|
&& chown node:node -R /app /node_modules
|
||||||
|
|
||||||
USER node
|
USER node
|
||||||
|
|
||||||
COPY --chown=node:node *yarn* package.json ./
|
COPY --chown=node:node assets/*yarn* assets/package.json ./
|
||||||
|
|
||||||
RUN yarn install && yarn cache clean
|
RUN yarn install && yarn cache clean
|
||||||
|
|
||||||
COPY --chown=node:node . .
|
COPY --chown=node:node . ..
|
||||||
|
|
||||||
RUN if [ "${NODE_ENV}" != "development" ]; then \
|
RUN if [ "${NODE_ENV}" != "development" ]; then \
|
||||||
./run yarn:build:css && ./run yarn:build:js; \
|
../run yarn:build:css && ../run yarn:build:js; \
|
||||||
else mkdir -p /app/build; fi
|
else mkdir -p /app/build; fi
|
||||||
|
|
||||||
CMD ["bash"]
|
CMD ["bash"]
|
||||||
|
|
29
website/assets/esbuild.config.js
Normal file
29
website/assets/esbuild.config.js
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
const esbuild = require("esbuild");
|
||||||
|
|
||||||
|
let minify = false;
|
||||||
|
let sourcemap = true;
|
||||||
|
let watch_fs = true;
|
||||||
|
|
||||||
|
if (process.env.NODE_ENV === "production") {
|
||||||
|
minify = true;
|
||||||
|
sourcemap = false;
|
||||||
|
watch_fs = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
const watch = watch_fs && {
|
||||||
|
onRebuild(error) {
|
||||||
|
if (error) console.error("[watch] build failed", error);
|
||||||
|
else console.log("[watch] build finished");
|
||||||
|
},
|
||||||
|
};
|
||||||
|
console.log(watch);
|
||||||
|
|
||||||
|
esbuild.build({
|
||||||
|
entryPoints: ["./js/app.js"],
|
||||||
|
outfile: "../source/build/app.js",
|
||||||
|
bundle: true,
|
||||||
|
minify: minify,
|
||||||
|
sourcemap: sourcemap,
|
||||||
|
watch: watch,
|
||||||
|
plugins: [],
|
||||||
|
});
|
|
@ -1,20 +1,19 @@
|
||||||
import 'alpinejs'
|
import "focus-visible";
|
||||||
import 'focus-visible'
|
import bash from "highlight.js/lib/languages/bash";
|
||||||
import bash from 'highlight.js/lib/languages/bash'
|
import hljs from "highlight.js/lib/core";
|
||||||
import hljs from 'highlight.js/lib/core'
|
import ini from "highlight.js/lib/languages/ini";
|
||||||
import ini from 'highlight.js/lib/languages/ini'
|
import javascript from "highlight.js/lib/languages/javascript";
|
||||||
import javascript from 'highlight.js/lib/languages/javascript'
|
import php from "highlight.js/lib/languages/php";
|
||||||
import php from 'highlight.js/lib/languages/php'
|
import yaml from "highlight.js/lib/languages/yaml";
|
||||||
import yaml from 'highlight.js/lib/languages/yaml'
|
|
||||||
|
|
||||||
hljs.registerLanguage('bash', bash);
|
hljs.registerLanguage("bash", bash);
|
||||||
hljs.registerLanguage('ini', ini);
|
hljs.registerLanguage("ini", ini);
|
||||||
hljs.registerLanguage('javascript', javascript);
|
hljs.registerLanguage("javascript", javascript);
|
||||||
hljs.registerLanguage('php', php);
|
hljs.registerLanguage("php", php);
|
||||||
hljs.registerLanguage('yaml', yaml);
|
hljs.registerLanguage("yaml", yaml);
|
||||||
|
|
||||||
document.addEventListener('DOMContentLoaded', event => {
|
document.addEventListener("DOMContentLoaded", (event) => {
|
||||||
document.querySelectorAll('pre code').forEach(block => {
|
document.querySelectorAll("pre code").forEach((element) => {
|
||||||
hljs.highlightBlock(block)
|
hljs.highlightElement(element);
|
||||||
})
|
});
|
||||||
})
|
});
|
||||||
|
|
|
@ -13,8 +13,8 @@ x-assets: &default-assets
|
||||||
services:
|
services:
|
||||||
css:
|
css:
|
||||||
<<: *default-assets
|
<<: *default-assets
|
||||||
command: "./run yarn:build:css"
|
command: "../run yarn:build:css"
|
||||||
|
|
||||||
js:
|
js:
|
||||||
<<: *default-assets
|
<<: *default-assets
|
||||||
command: "./run yarn:build:js"
|
command: "../run yarn:build:js"
|
||||||
|
|
|
@ -1,28 +0,0 @@
|
||||||
const esbuild = require('esbuild')
|
|
||||||
|
|
||||||
let minify = false
|
|
||||||
let sourcemap = true
|
|
||||||
let watch_fs = true
|
|
||||||
|
|
||||||
if (process.env.NODE_ENV === 'production') {
|
|
||||||
minify = true
|
|
||||||
sourcemap = false
|
|
||||||
watch_fs = false
|
|
||||||
}
|
|
||||||
|
|
||||||
const watch = watch_fs && {
|
|
||||||
onRebuild(error) {
|
|
||||||
if (error) console.error('[watch] build failed', error)
|
|
||||||
else console.log('[watch] build finished')
|
|
||||||
},
|
|
||||||
}
|
|
||||||
|
|
||||||
esbuild.build({
|
|
||||||
entryPoints: ['./assets/js/app.js'],
|
|
||||||
outfile: './build/app.js',
|
|
||||||
bundle: true,
|
|
||||||
minify: minify,
|
|
||||||
sourcemap: sourcemap,
|
|
||||||
watch: watch,
|
|
||||||
plugins: [],
|
|
||||||
})
|
|
|
@ -87,7 +87,7 @@ function yarn:build:css {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
tailwindcss --postcss \
|
tailwindcss --postcss \
|
||||||
-i assets/css/tailwind.pcss \
|
-i css/tailwind.pcss \
|
||||||
-o source/build/app.css "${args[@]}"
|
-o source/build/app.css "${args[@]}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue