diff --git a/symfony/stimulus-bundle/2.13/assets/bootstrap.js b/symfony/stimulus-bundle/2.13/assets/bootstrap.js new file mode 100644 index 000000000..2689398a6 --- /dev/null +++ b/symfony/stimulus-bundle/2.13/assets/bootstrap.js @@ -0,0 +1,2 @@ +// register any custom, 3rd party controllers here +// app.register('some_controller_name', SomeImportedController); diff --git a/symfony/stimulus-bundle/2.13/assets/controllers.json b/symfony/stimulus-bundle/2.13/assets/controllers.json new file mode 100644 index 000000000..a1c6e90cf --- /dev/null +++ b/symfony/stimulus-bundle/2.13/assets/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/symfony/stimulus-bundle/2.13/assets/controllers/hello_controller.js b/symfony/stimulus-bundle/2.13/assets/controllers/hello_controller.js new file mode 100644 index 000000000..e847027bd --- /dev/null +++ b/symfony/stimulus-bundle/2.13/assets/controllers/hello_controller.js @@ -0,0 +1,16 @@ +import { Controller } from '@hotwired/stimulus'; + +/* + * This is an example Stimulus controller! + * + * Any element with a data-controller="hello" attribute will cause + * this controller to be executed. The name "hello" comes from the filename: + * hello_controller.js -> "hello" + * + * Delete this file or adapt it for your use! + */ +export default class extends Controller { + connect() { + this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js'; + } +} diff --git a/symfony/stimulus-bundle/2.13/manifest.json b/symfony/stimulus-bundle/2.13/manifest.json new file mode 100644 index 000000000..470121517 --- /dev/null +++ b/symfony/stimulus-bundle/2.13/manifest.json @@ -0,0 +1,39 @@ +{ + "bundles": { + "Symfony\\UX\\StimulusBundle\\StimulusBundle": ["all"] + }, + "copy-from-recipe": { + "assets/": "assets/" + }, + "aliases": ["stimulus", "stimulus-bundle"], + "conflict": { + "symfony/webpack-encore-bundle": "<2.0", + "symfony/flex": "<1.20.0 || >=2.0.0,<2.3.0" + }, + "add-lines": [ + { + "file": "webpack.config.js", + "content": "\n // enables the Symfony UX Stimulus bridge (used in assets/bootstrap.js)\n .enableStimulusBridge('./assets/controllers.json')", + "position": "after_target", + "target": ".splitEntryChunks()" + }, + { + "file": "assets/app.js", + "content": "import './bootstrap.js';", + "position": "top", + "warn_if_missing": true + }, + { + "file": "assets/bootstrap.js", + "content": "import { startStimulusApp } from '@symfony/stimulus-bridge';\n\n// Registers Stimulus controllers from controllers.json and in the controllers/ directory\nexport const app = startStimulusApp(require.context(\n '@symfony/stimulus-bridge/lazy-controller-loader!./controllers',\n true,\n /\\.[jt]sx?$/\n));", + "position": "top", + "requires": "symfony/webpack-encore-bundle" + }, + { + "file": "assets/bootstrap.js", + "content": "import { startStimulusApp } from '@symfony/stimulus-bundle';\n\nconst app = startStimulusApp();", + "position": "top", + "requires": "symfony/asset-mapper" + } + ] +}