Sen descrición

Caleb Porzio 9e0e49fce5 Merge branch 'main' into bug/fix-error-msg-interpolation hai 1 ano
.github 1391d76b7c run-tests: bump actions and node (#3390) %!s(int64=2) %!d(string=hai) anos
benchmarks 1e72dfb22e use normal single quotes (#3764) hai 1 ano
packages 9e0e49fce5 Merge branch 'main' into bug/fix-error-msg-interpolation hai 1 ano
scripts 1c2c67514f Add csp build to release hai 1 ano
tests 650de45ab0 Fix x-mask when used with wire:model (#3988) hai 1 ano
.editorconfig 4a1ecdbd1a Add editorconfig file %!s(int64=5) %!d(string=hai) anos
.gitignore d3765d64fa Remove .only from x-on.spec (#2545) %!s(int64=3) %!d(string=hai) anos
LICENSE.md 26ffa65753 Update README.id.md & years of copyright %!s(int64=4) %!d(string=hai) anos
README.md 5b88c86e9e fix: typo on alt "component" (#3541) %!s(int64=2) %!d(string=hai) anos
cypress.json b46c41fa24 Import V3 source %!s(int64=3) %!d(string=hai) anos
hero.jpg 11d7e8ce8d wip %!s(int64=3) %!d(string=hai) anos
index.html 2a566bb464 Fix initial value setting for boolean radio hai 1 ano
index2.html 2fcabfe906 undo-me %!s(int64=3) %!d(string=hai) anos
jest.config.js b46c41fa24 Import V3 source %!s(int64=3) %!d(string=hai) anos
morph.html 938bb33350 Make morphdom faster and more powerful (#3692) hai 1 ano
package-lock.json e67d428036 wip hai 1 ano
package.json 5c461c4d21 Make test output in CI quiet hai 1 ano

README.md

Alpine.js

Go to the Alpine docs for most things: Alpine Docs

You are welcome to submit updates to the docs by submitting a PR to this repo. Docs are located in the /packages/docs directory.

Stay here for contribution-related information.

Looking for V2 docs? here they are

Alpine Component Patterns

Contribution Guide:

Quickstart

  • clone this repo locally
  • run npm install & npm run build
  • Include the /packages/alpinejs/dist/cdn.js file from a <script> tag on a webpage and you're good to go!

Brief Tour

You can get everything installed with: npm install in the root directory of this repo after cloning it locally.

This repo is a "mono-repo" using npm workspaces for managing the packages. Each package has its own folder in the /packages directory.

Rather than having to run separate builds for each package, all package bundles are handled with the same command: npm run build

Here's a brief look at each package in this repo:

Package Description
alpinejs The main Alpine repo with all of Alpine's core
collapse A plugin for expanding and collapsing elements using smooth animations
csp A repo to provide a "CSP safe" build of Alpine
docs The Alpine documentation
focus A plugin that allows you to manage focus inside an element
history A plugin for binding data to query string parameters using the history API (name is likely to change)
intersect A plugin for triggering JS expressions based on elements intersecting with the viewport
mask A plugin for automatically formatting a text input field as a user types
morph A plugin for morphing HTML (like morphdom) inside the page intelligently
persist A plugin for persisting Alpine state across page loads

The compiled JS files (as a result of running npm run [build/watch]) to be included as a <script> tag for example are stored in each package's packages/[package]/dist directory.

Each package should at least have: a "cdn" build that is self-initializing and can be included using the src attribute in a <script defer> tag, and a module.[esm/cjs].js file that is used for importing as a JS module (cjs for node, esm for everything else).

The bundling for Alpine V3 is handled exclusively by ESBuild. All of the configuration for these builds is stored in the scripts/build.js file.

Testing

There are 2 different testing tools used in this repo: Cypress (for integration tests), and Jest (for unit tests).

All tests are stored inside the /tests folder under /tests/cypress and /tests/jest.

You can run them both from the command line using: npm run test

If you wish to only run cypress and open it's user interface (recommended during development), you can run: npm run cypress

If you wish to only run Jest tests, you can run npm run jest like normal and target specific tests. You can specify command line config options to forward to the jest command with -- like so: npm run jest -- --watch