2.7.2 • Published 2 months ago
@saulx/aristotle-build v2.7.2
build
Build for production
import build from 'ops-build'
const result = await build({
entryPoints: ['index.js'],
minify: true,
outdir: 'dist'
})
Dev builds
import build from 'ops-build'
const result = await build({
entryPoints: ['index.js'],
sourcemap: true
})
Dev Server Example
import build from 'ops-build'
const buildOpts = {
entryPoints: ['index.js'],
sourcemap: true,
watch: true
}
const render = ({ styles, scripts, files }) =>
`<html>
<head>
${styles.map(({ text }) => `<style>${text}</style>`).join('')}
</head>
<body>
<div id="root"></div>
${scripts.map(({ url }) => `<script src="${url}"></script>`).join('')}
</body>
</html>`
http.createServer(async (req, res) => {
const result = await build(buildOpts)
const { styles, scripts, files } = result
if (!req.url || req.url === '/index.html') {
res.writeHead(200, { 'content-type': 'text/html' })
res.end(render(result))
} else if (req.url in files) {
res.writeHead(200, { 'content-type': files[req.url].type })
res.end(Buffer.from(files[req.url].contents))
} else {
res.writeHead(404)
res.end()
}
})
2.7.2
2 months ago
2.7.0
1 year ago
2.6.0
1 year ago
2.7.1
1 year ago
2.5.4
2 years ago
2.5.3
2 years ago
2.5.5
2 years ago
2.3.0
2 years ago
2.2.0
2 years ago
2.5.0
2 years ago
2.3.2
2 years ago
2.4.0
2 years ago
2.3.1
2 years ago
2.5.2
2 years ago
2.5.1
2 years ago
2.3.3
2 years ago
2.1.0
2 years ago
2.0.10
3 years ago
2.0.5
3 years ago
2.0.7
3 years ago
2.0.6
3 years ago
2.0.9
3 years ago
2.0.8
3 years ago
2.0.4
3 years ago
2.0.3
3 years ago
2.0.2
3 years ago
2.0.1
3 years ago
2.0.0
3 years ago
1.0.15
3 years ago
1.0.14
3 years ago
1.0.13
3 years ago
1.0.12
3 years ago
1.0.11
3 years ago
1.0.10
3 years ago
1.0.9
3 years ago
1.0.8
3 years ago
1.0.7
3 years ago
1.0.6
3 years ago
1.0.5
3 years ago
1.0.4
3 years ago
1.0.3
3 years ago
1.0.2
3 years ago
1.0.1
3 years ago