Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: cdn.no-start(.min).js version #4289

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions packages/alpinejs/builds/cdn.no-start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Alpine from './../src/index'

window.Alpine = Alpine
3 changes: 3 additions & 0 deletions packages/csp/builds/cdn.no-start.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import Alpine from './../src/index'

window.Alpine = Alpine
23 changes: 23 additions & 0 deletions scripts/build.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,29 @@ function bundleFile(package, file) {
outputSize(package, `packages/${package}/dist/${file.replace('.js', '.min.js')}`)
})

},
// This output file is meant to be loaded in a browser's <script> tag but without auto Alpine.start()
'cdn.no-start.js': () => {
build({
entryPoints: [`packages/${package}/builds/${file}`],
outfile: `packages/${package}/dist/${file}`,
bundle: true,
platform: 'browser',
define: { CDN: 'true' },
})

// Build a minified version.
build({
entryPoints: [`packages/${package}/builds/${file}`],
outfile: `packages/${package}/dist/${file.replace('.js', '.min.js')}`,
bundle: true,
minify: true,
platform: 'browser',
define: { CDN: 'true' },
}).then(() => {
outputSize(package, `packages/${package}/dist/${file.replace('.js', '.min.js')}`)
})

},
// This file outputs two files: an esm module and a cjs module.
// The ESM one is meant for "import" statements (bundlers and new browsers)
Expand Down
Loading