8000 getting stimulus & turbo functional · weaverryan/symfony-demo@1d84a95 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1d84a95

Browse files
committed
getting stimulus & turbo functional
1 parent 68c8075 commit 1d84a95

36 files changed

+73933
-2831
lines changed

assets/bootstrap.js

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+
/\.(j|t)sx?$/
8+
));
9+
10+
// register any custom, 3rd party controllers here
11+
// app.register('some_controller_name', SomeImportedController);

assets/controllers.json

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"controllers": {
3+
"@symfony/ux-turbo": {
4+
"turbo-core": {
5+
"enabled": true,
6+
"fetch": "eager"
7+
}
8+
}
9+
},
10+
"entrypoints": []
11+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
import { Controller } from '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+
}

assets/js/app.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,4 @@ import './highlight.js';
1313

1414
// Creates links to the Symfony documentation
1515
import './doclinks.js';
16+
import './../bootstrap';

config/packages/webpack_encore.yaml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,21 @@ webpack_encore:
44
# If multiple builds are defined (as shown below), you can disable the default build:
55
# output_path: false
66

7-
# if using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
7+
# Set attributes that will be rendered on all script and link tags
8+
script_attributes:
9+
defer: true
10+
# link_attributes:
11+
12+
# If using Encore.enableIntegrityHashes() and need the crossorigin attribute (default: false, or use 'anonymous' or 'use-credentials')
813
# crossorigin: 'anonymous'
914

10-
# preload all rendered script and link tags automatically via the http2 Link header
15+
# Preload all rendered script and link tags automatically via the HTTP/2 Link header
1116
# preload: true
1217

1318
# Throw an exception if the entrypoints.json file is missing or an entry is missing from the data
1419
# strict_mode: false
1520

16-
# if you have multiple builds:
21+
# If you have multiple builds:
1722
# builds:
1823
# pass "frontend" as the 3rg arg to the Twig functions
1924
# {{ encore_entry_script_tags('entry1', null, 'frontend') }}

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
"imports-loader": "^0.8.0",
1414
"jquery": "^3.5.1",
1515
"lato-font": "^3.0.0",
16-
"node-sass": "^4.9.3",
1716
"sass-loader": "^9.0.1",
1817
"typeahead.js": "^0.11.1"
1918
},
@@ -24,5 +23,10 @@
2423
"dev": "encore dev",
2524
"watch": "encore dev --watch",
2625
"build": "encore production --progress"
26+
},
27+
"dependencies": {
28+
"@symfony/stimulus-bridge": "^2.1.0",
29+
"sass": "^1.32.12",
30+
"stimulus": "^2.0.0"
2731
}
28-
}
32+
}

public/build/498.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

public/build/755.js

Lines changed: 0 additions & 2 deletions
This file was deleted.

public/build/755.js.LICENSE.txt

Lines changed: 0 additions & 24 deletions
This file was deleted.

public/build/898.css

Lines changed: 0 additions & 9 deletions
This file was deleted.

0 commit comments

Comments
 (0)
0