Skip to content

Instantly share code, notes, and snippets.

@h3llr4iser
Forked from CaptainJojo/App.vue
Created February 28, 2018 08:16
Show Gist options
  • Select an option

  • Save h3llr4iser/4b3792f2a2e48e299a44f5e2a41bc855 to your computer and use it in GitHub Desktop.

Select an option

Save h3llr4iser/4b3792f2a2e48e299a44f5e2a41bc855 to your computer and use it in GitHub Desktop.

Revisions

  1. @CaptainJojo CaptainJojo created this gist Jan 16, 2018.
    14 changes: 14 additions & 0 deletions App.vue
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    <template>
    <div id="app">
    {{ message }}
    </div>
    </template>
    <script>
    export default {
    data() {
    return {
    message: 'Hello World'
    }
    }
    }
    </script>
    18 changes: 18 additions & 0 deletions DefaultController.php
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,18 @@
    <?php

    namespace App\Controller;

    use Symfony\Component\HttpFoundation\Response;
    use Symfony\Component\Routing\Annotation\Route;
    use Symfony\Bundle\FrameworkBundle\Controller\Controller;

    class DefaultController extends Controller
    {
    /**
    * @Route("/")
    */
    public function home()
    {
    return $this->render('home.html.twig');
    }
    }
    19 changes: 19 additions & 0 deletions Project
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,19 @@
    your-project/
    ├── assets/
    ├── bin/
    │ └── console
    ├── config/
    │ ├── bundles.php
    │ ├── packages/
    │ ├── routes.yaml
    │ └── services.yaml
    ├── public/
    │ └── index.php
    ├── src/
    │ ├── ...
    │ └── Kernel.php
    ├── templates/
    ├── tests/
    ├── translations/
    ├── var/
    └── vendor/
    6 changes: 6 additions & 0 deletions app.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    import App from './components/App.vue';
    import Vue from 'vue';
    new Vue({
    el: '#app',
    render: h => h(App)
    });
    15 changes: 15 additions & 0 deletions home.html.twig
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,15 @@
    <!DOCTYPE html>
    <html>
    <head>
    <meta charset="UTF-8">
    <title>{% block title %}Welcome!{% endblock %}</title>
    {% block stylesheets %}{% endblock %}
    </head>
    <body>
    {% block body %}
    <div id="app">SALUT</div>
    {% endblock %}
    {% block javascripts %}
    {% endblock %}
    </body>
    </html>
    1 change: 1 addition & 0 deletions script
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    <script src="{{ asset('build/app.js') }}"></script>
    14 changes: 14 additions & 0 deletions webpack.config.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,14 @@
    var Encore = require('@symfony/webpack-encore');

    Encore
    // the project directory where compiled assets will be stored
    .setOutputPath('public/build/')
    // the public path used by the web server to access the previous directory
    .setPublicPath('/build')
    .addEntry('app', './assets/js/app.js')
    .cleanupOutputBeforeBuild()
    .enableSourceMaps(!Encore.isProduction())
    .enableVueLoader()
    ;

    module.exports = Encore.getWebpackConfig();