Skip to content

Commit 7845ebb

Browse files
authored
Merge pull request #1463 from Kocal/GH-1457
[WebpackEncoreBundle] Add recipe for old version 1.17 & fix some other constraints
2 parents bf21b8a + a91c2d7 commit 7845ebb

File tree

13 files changed

+216
-3
lines changed

13 files changed

+216
-3
lines changed

symfony/webpack-encore-bundle/1.10/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"@babel/core": "^7.17.0",
44
"@babel/preset-env": "^7.16.0",
55
"@hotwired/stimulus": "^3.0.0",
6-
"@symfony/stimulus-bridge": "^4.0.0",
6+
"@symfony/stimulus-bridge": "^3.0.0",
77
"@symfony/webpack-encore": "^4.0.0",
88
"core-js": "^3.23.0",
99
"regenerator-runtime": "^0.13.9",
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
/*
2+
* Welcome to your app's main JavaScript file!
3+
*
4+
* We recommend including the built version of this JavaScript file
5+
* (and its CSS file) in your base layout (base.html.twig).
6+
*/
7+
8+
// any CSS you import will output into a single css file (app.css in this case)
9+
import './styles/app.css';
10+
11+
// start the Stimulus application
12+
import './bootstrap';
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
import { startStimulusApp } from '@symfony/stimulus-bridge';
2+
3+
// Registers Stimulus controllers from controllers.json and in the controllers/ directory
4+
export const app = startStimulusApp(require.context(
5+
'@symfony/stimulus-bridge/lazy-controller-loader!./controllers',
6+
true,
7+
/\.[jt]sx?$/
8+
));
9+
10+
// register any custom, 3rd party controllers here
11+
// app.register('some_controller_name', SomeImportedController);
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"controllers": [],
3+
"entrypoints": []
4+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Controller } from '@hotwired/stimulus';
2+
3+
/*
4+
* This is an example Stimulus controller!
5+
*
6+
* Any element with a data-controller="hello" attribute will cause
7+
* this controller to be executed. The name "hello" comes from the filename:
8+
* hello_controller.js -> "hello"
9+
*
10+
* Delete this file or adapt it for your use!
11+
*/
12+
export default class extends Controller {
13+
connect() {
14+
this.element.textContent = 'Hello Stimulus! Edit me in assets/controllers/hello_controller.js';
15+
}
16+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
body {
2+
background-color: lightgray;
3+
}
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
webpack_encore:
2+
# The path where Encore is building the assets - i.e. Encore.setOutputPath()
3+
output_path: '%kernel.project_dir%/public/build'
4+
# If multiple builds are defined (as shown below), you can disable the default build:
5+
# output_path: false
6+
7+
# Set attributes that will be rendered on all script and link tags
8+
script_attributes:
9+
defer: true
10+
# Uncomment (also under link_attributes) if using Turbo Drive
11+
# https://turbo.hotwired.dev/handbook/drive#reloading-when-assets-change
12+
# 'data-turbo-track': reload
13+
# link_attributes:
14+
# Uncomment if using Turbo Drive
15+
# 'data-turbo-track': reload
16+
17+
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
18+
# crossorigin: 'anonymous'
19+
20+
# Preload all rendered script and link tags automatically via the HTTP/2 Link header
21+
# preload: true
22+
23+
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
24+
# strict_mode: false
25+
26+
# If you have multiple builds:
27+
# builds:
28+
# frontend: '%kernel.project_dir%/public/frontend/build'
29+
30+
# pass the build name as the 3rd argument to the Twig functions
31+
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}
32+
33+
framework:
34+
assets:
35+
json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'
36+
37+
#when@prod:
38+
# webpack_encore:
39+
# # Cache the entrypoints.json (rebuild Symfony's cache when entrypoints.json changes)
40+
# # Available in version 1.2
41+
# cache: true
42+
43+
#when@test:
44+
# webpack_encore:
45+
# strict_mode: false
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{
2+
"bundles": {
3+
"Symfony\\WebpackEncoreBundle\\WebpackEncoreBundle": ["all"]
4+
},
5+
"copy-from-recipe": {
6+
"assets/": "assets/",
7+
"config/": "%CONFIG_DIR%/",
8+
"package.json": "package.json",
9+
"webpack.config.js": "webpack.config.js"
10+
},
11+
"aliases": ["encore", "webpack", "webpack-encore"],
12+
"gitignore": [
13+
"/node_modules/",
14+
"/%PUBLIC_DIR%/build/",
15+
"npm-debug.log",
16+
"yarn-error.log"
17+
],
18+
"conflict": {
19+
"symfony/framework-bundle": "<5.4"
20+
}
21+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
{
2+
"devDependencies": {
3+
"@babel/core": "^7.17.0",
4+
"@babel/preset-env": "^7.16.0",
5+
"@hotwired/stimulus": "^3.0.0",
6+
"@symfony/stimulus-bridge": "^4.0.0",
7+
"@symfony/webpack-encore": "^5.1.0",
8+
"core-js": "^3.23.0",
9+
"regenerator-runtime": "^0.13.9",
10+
"webpack": "^5.74.0",
11+
"webpack-cli": "^4.10.0",
12+
"webpack-notifier": "^1.15.0"
13+
},
14+
"license": "UNLICENSED",
15+
"private": true,
16+
"scripts": {
17+
"dev-server": "encore dev-server",
18+
"dev": "encore dev",
19+
"watch": "encore dev --watch",
20+
"build": "encore production --progress"
21+
}
22+
}
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
* Install Yarn and run <fg=green>yarn install</>
2+
3+
* Start the development server: <fg=green>yarn encore dev-server</>

0 commit comments

Comments
 (0)