From 0da879347dd7800c819522d171b330226ff2f584 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jan=20B=C3=B6hmer?= Date: Sun, 3 Jan 2021 20:54:47 +0100 Subject: [PATCH] Updated symfony recipes. --- assets/app.js | 12 ++++++++++++ assets/bootstrap.js | 5 +++++ assets/controllers.json | 4 ++++ assets/controllers/hello_controller.js | 16 ++++++++++++++++ assets/styles/app.css | 3 +++ config/packages/prod/doctrine.yaml | 2 +- config/preload.php | 5 +++++ config/routes/php_translation.yaml | 2 +- symfony.lock | 22 +++++++++++++--------- 9 files changed, 60 insertions(+), 11 deletions(-) create mode 100644 assets/app.js create mode 100644 assets/bootstrap.js create mode 100644 assets/controllers.json create mode 100644 assets/controllers/hello_controller.js create mode 100644 assets/styles/app.css create mode 100644 config/preload.php diff --git a/assets/app.js b/assets/app.js new file mode 100644 index 00000000..bb0a6aa1 --- /dev/null +++ b/assets/app.js @@ -0,0 +1,12 @@ +/* + * Welcome to your app's main JavaScript file! + * + * We recommend including the built version of this JavaScript file + * (and its CSS file) in your base layout (base.html.twig). + */ + +// any CSS you import will output into a single css file (app.css in this case) +import './styles/app.css'; + +// start the Stimulus application +import './bootstrap'; diff --git a/assets/bootstrap.js b/assets/bootstrap.js new file mode 100644 index 00000000..9792e6ab --- /dev/null +++ b/assets/bootstrap.js @@ -0,0 +1,5 @@ +import { startStimulusApp } from '@symfony/stimulus-bridge'; +import '@symfony/autoimport'; + +// Registers Stimulus controllers from controllers.json and in the controllers/ directory +export const app = startStimulusApp(require.context('./controllers', true, /\.(j|t)sx?$/)); diff --git a/assets/controllers.json b/assets/controllers.json new file mode 100644 index 00000000..a1c6e90c --- /dev/null +++ b/assets/controllers.json @@ -0,0 +1,4 @@ +{ + "controllers": [], + "entrypoints": [] +} diff --git a/assets/controllers/hello_controller.js b/assets/controllers/hello_controller.js new file mode 100644 index 00000000..8c79f65a --- /dev/null +++ b/assets/controllers/hello_controller.js @@ -0,0 +1,16 @@ +import { Controller } from '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/assets/styles/app.css b/assets/styles/app.css new file mode 100644 index 00000000..cb33b131 --- /dev/null +++ b/assets/styles/app.css @@ -0,0 +1,3 @@ +body { + background-color: lightgray; +} diff --git a/config/packages/prod/doctrine.yaml b/config/packages/prod/doctrine.yaml index 513704c8..084f59a0 100644 --- a/config/packages/prod/doctrine.yaml +++ b/config/packages/prod/doctrine.yaml @@ -17,4 +17,4 @@ framework: doctrine.result_cache_pool: adapter: cache.app doctrine.system_cache_pool: - adapter: cache.system \ No newline at end of file + adapter: cache.system diff --git a/config/preload.php b/config/preload.php new file mode 100644 index 00000000..5ebcdb21 --- /dev/null +++ b/config/preload.php @@ -0,0 +1,5 @@ +