@krebil/parcel-stimulus-automagic

1.0.2 • Public • Published

stimulus-automagic with Parcel

Inspired by: Stimulus-webpack-helpers

This allows you to add your stimulus controllers automagically with minimal setup.

Prerequisites

This depends on Parcel's glob resolver: @parcel/resolver-glob Install it and add it to your parcel configuration file (.parcelrc).

{

  "extends": "@parcel/config-default",
  "resolvers": ["@parcel/resolver-glob", "..."]
  
}

Installation

npm install @krebil/parcel-stimulus-automagic

Usage

import the folder where your controllers are into your js file. import * as controllers from "./controllers/**/*.ts" or import * as controllers from "./controllers/**/*.js"

Then import definitionsFromContext and use it like in the webpack-helpers repo.

import {definitionsFromContext} from "@krebil/parcel-stimulus-automagic";

var f = definitionsFromContext(controllers)

window.Stimulus = Application.start() 

window.Stimulus.load(f)

And that's it!

Clone this repo for a complete example

Readme

Keywords

none

Package Sidebar

Install

npm i @krebil/parcel-stimulus-automagic

Weekly Downloads

0

Version

1.0.2

License

ISC

Unpacked Size

5.87 kB

Total Files

9

Last publish

Collaborators

  • krebil