Skip to content

Commit 8b07cb7

Browse files
committed
ISSUE-345: add vue.js
1 parent e466488 commit 8b07cb7

File tree

9 files changed

+3005
-1
lines changed

9 files changed

+3005
-1
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
/vendor/
1616
.phpunit.result.cache
1717
.env
18+
/node_modules

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,3 +42,4 @@ this code.
4242
## Command to running this project for local testing
4343

4444
symfony local:server:start
45+
yarn encore dev

assets/app.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import { createApp } from 'vue';
2+
import App from './vue/App.vue';
3+
4+
createApp(App).mount('#vue-app');

assets/vue/App.vue

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
<template>
2+
<div>
3+
<h1>Hello from Vue!</h1>
4+
</div>
5+
</template>
6+
7+
<script>
8+
export default {
9+
name: 'App'
10+
}
11+
</script>

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@
3131
"require": {
3232
"php": "^8.1",
3333
"phplist/core": "dev-ISSUE-345",
34-
"symfony/twig-bundle": "^6.4"
34+
"symfony/twig-bundle": "^6.4",
35+
"symfony/webpack-encore-bundle": "^2.2"
3536
},
3637
"require-dev": {
3738
"phpunit/phpunit": "^9.5",

package.json

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
{
2+
"devDependencies": {
3+
"@babel/core": "^7.27.4",
4+
"@babel/preset-env": "^7.27.2",
5+
"@symfony/webpack-encore": "^5.1.0",
6+
"babel-loader": "^10.0.0",
7+
"vue-loader": "^17.3.1",
8+
"vue-template-compiler": "^2.7.14",
9+
"webpack": "^5.99.9",
10+
"webpack-cli": "^6.0.1",
11+
"webpack-notifier": "^1.15.0"
12+
},
13+
"dependencies": {
14+
"vue": "3"
15+
}
16+
}

templates/base.html.twig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css">
1010

1111
{# Add your own custom CSS later if needed #}
12+
{{ encore_entry_link_tags('app') }}
1213
</head>
1314
<body>
1415
<main class="container mt-5">
@@ -18,5 +19,6 @@
1819
{# Optionally include Bootstrap JS if you use interactive components #}
1920
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js"></script>
2021
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js"></script>
22+
{{ encore_entry_script_tags('app') }}
2123
</body>
2224
</html>

webpack.config.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
const Encore = require('@symfony/webpack-encore');
2+
3+
Encore
4+
.setOutputPath('public/build/')
5+
.setPublicPath('/build')
6+
.enableVueLoader()
7+
.addEntry('app', './assets/app.js')
8+
.cleanupOutputBeforeBuild()
9+
.enableBuildNotifications()
10+
.enableSourceMaps(!Encore.isProduction())
11+
.enableVersioning(Encore.isProduction())
12+
.enableSingleRuntimeChunk()
13+
;
14+
15+
module.exports = Encore.getWebpackConfig();

yarn.lock

Lines changed: 2953 additions & 0 deletions
Large diffs are not rendered by default.

0 commit comments

Comments
 (0)