Browse Source

add Webpack Encore to the project #3

Laszlo Lang 3 months ago
parent
commit
fd32e4c8fd
12 changed files with 5627 additions and 37 deletions
  1. 7
    0
      .gitignore
  2. 0
    0
      assets/.gitignore
  3. 0
    0
      assets/css/app.scss
  4. 0
    0
      assets/js/app.js
  5. 1
    0
      composer.json
  6. 33
    2
      composer.lock
  7. 3
    0
      config/packages/assets.yaml
  8. 19
    0
      package.json
  9. 0
    35
      public/admin/layout.html.twig
  10. 9
    0
      symfony.lock
  11. 53
    0
      webpack.config.js
  12. 5502
    0
      yarn.lock

+ 7
- 0
.gitignore View File

@@ -27,3 +27,10 @@ npm-debug.log
27 27
 ###< system7 - project ###
28 28
 
29 29
 
30
+
31
+###> symfony/webpack-encore-pack ###
32
+/node_modules/
33
+/public/build/
34
+npm-debug.log
35
+yarn-error.log
36
+###< symfony/webpack-encore-pack ###

+ 0
- 0
assets/.gitignore View File


+ 0
- 0
assets/css/app.scss View File


+ 0
- 0
assets/js/app.js View File


+ 1
- 0
composer.json View File

@@ -17,6 +17,7 @@
17 17
         "symfony/orm-pack": "^1.0",
18 18
         "symfony/swiftmailer-bundle": "^3.2",
19 19
         "symfony/twig-bundle": "^4.1",
20
+        "symfony/webpack-encore-pack": "^1.0",
20 21
         "symfony/yaml": "^4.1"
21 22
     },
22 23
     "require-dev": {

+ 33
- 2
composer.lock View File

@@ -4,8 +4,8 @@
4 4
         "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#composer-lock-the-lock-file",
5 5
         "This file is @generated automatically"
6 6
     ],
7
-    "hash": "f94323acc46fc167225b86cf0ca74fe0",
8
-    "content-hash": "1eeeee734173ab013843d93fb6f6f970",
7
+    "hash": "1de43cb6ca7ba3a18b762136f8599961",
8
+    "content-hash": "bde4b31209bcee7916811224485835f6",
9 9
     "packages": [
10 10
         {
11 11
             "name": "cocur/slugify",
@@ -5949,6 +5949,37 @@
5949 5949
             "time": "2018-07-26 11:24:31"
5950 5950
         },
5951 5951
         {
5952
+            "name": "symfony/webpack-encore-pack",
5953
+            "version": "v1.0.3",
5954
+            "source": {
5955
+                "type": "git",
5956
+                "url": "https://github.com/symfony/webpack-encore-pack.git",
5957
+                "reference": "8d7f51379d7ae17aea7cf501d910a11896895ac4"
5958
+            },
5959
+            "dist": {
5960
+                "type": "zip",
5961
+                "url": "https://api.github.com/repos/symfony/webpack-encore-pack/zipball/8d7f51379d7ae17aea7cf501d910a11896895ac4",
5962
+                "reference": "8d7f51379d7ae17aea7cf501d910a11896895ac4",
5963
+                "shasum": ""
5964
+            },
5965
+            "require": {
5966
+                "symfony/asset": "^3.3|^4.0"
5967
+            },
5968
+            "type": "symfony-pack",
5969
+            "extra": {
5970
+                "thanks": {
5971
+                    "name": "symfony/webpack-encore",
5972
+                    "url": "https://github.com/symfony/webpack-encore"
5973
+                }
5974
+            },
5975
+            "notification-url": "https://packagist.org/downloads/",
5976
+            "license": [
5977
+                "MIT"
5978
+            ],
5979
+            "description": "A pack for Symfony Encore",
5980
+            "time": "2018-07-16 10:15:28"
5981
+        },
5982
+        {
5952 5983
             "name": "symfony/yaml",
5953 5984
             "version": "v4.1.3",
5954 5985
             "source": {

+ 3
- 0
config/packages/assets.yaml View File

@@ -0,0 +1,3 @@
1
+framework:
2
+    assets:
3
+        json_manifest_path: '%kernel.project_dir%/public/build/manifest.json'

+ 19
- 0
package.json View File

@@ -0,0 +1,19 @@
1
+{
2
+    "devDependencies": {
3
+        "@symfony/webpack-encore": "^0.19.0",
4
+        "node-sass": "^4.9.3",
5
+        "sass-loader": "^7.1.0",
6
+        "webpack-notifier": "^1.6.0"
7
+    },
8
+    "license": "UNLICENSED",
9
+    "private": true,
10
+    "scripts": {
11
+        "dev-server": "encore dev-server",
12
+        "dev": "encore dev",
13
+        "watch": "encore dev --watch",
14
+        "build": "encore production"
15
+    },
16
+    "dependencies": {
17
+        "@fortawesome/fontawesome-free": "^5.2.0"
18
+    }
19
+}

+ 0
- 35
public/admin/layout.html.twig View File

@@ -1,35 +0,0 @@
1
-{% extends '@SonataAdmin/standard_layout.html.twig' %}
2
-{#
3
-{% block stylesheets %}
4
-    {{ parent() }}
5
-    <link rel="stylesheet" href="{{ asset('bundles/sonatatranslation/css/sonata-translation.css') }}"/>
6
-{% endblock %}
7
-
8
-{% block javascripts %}
9
-    {{ parent() }}
10
-    <script type="text/javascript" src="{{ asset('build/admin.js') }}"></script>
11
-{% endblock %}
12
-#}
13
-
14
-{% block logo %}
15
-    {% spaceless %}
16
-        <a class="logo" href="{{ path('sonata_admin_dashboard') }}">
17
-            {#{% if 'single_image' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
18
-                <img src="{{ asset('/images/bear-3@1000.png') }}" alt="{{ sonata_admin.adminPool.title }}" border="0" width="50">
19
-            {% endif %}#}
20
-            {% if 'single_text' == sonata_admin.adminPool.getOption('title_mode') or 'both' == sonata_admin.adminPool.getOption('title_mode') %}
21
-                <span>{{ jotunTitle }}</span>
22
-            {% endif %}
23
-        </a>
24
-    {% endspaceless %}
25
-{% endblock %}
26
-
27
-{% block side_bar_after_nav_content %}
28
-    <a href="https://www.laszlolang.com" rel="noreferrer" target="_blank">
29
-        <img src="{{ asset('/images/system7-Bear-created-by-light@100.png') }}"
30
-             border="0"
31
-             alt="www.laszlolang.com"> <br>
32
-        www.laszlolang.com &copy; 2010-{{ "now"|date('Y') }} <br>
33
-        v{{ jotunVersion }}
34
-    </a>
35
-{% endblock %}

+ 9
- 0
symfony.lock View File

@@ -392,6 +392,15 @@
392 392
             "ref": "6bdfa1a95f6b2e677ab985cd1af2eae35d62e0f6"
393 393
         }
394 394
     },
395
+    "symfony/webpack-encore-pack": {
396
+        "version": "1.0",
397
+        "recipe": {
398
+            "repo": "github.com/symfony/recipes",
399
+            "branch": "master",
400
+            "version": "1.0",
401
+            "ref": "b87dfd249390a7b534caa137450277930901236e"
402
+        }
403
+    },
395 404
     "symfony/yaml": {
396 405
         "version": "v4.1.3"
397 406
     },

+ 53
- 0
webpack.config.js View File

@@ -0,0 +1,53 @@
1
+var Encore = require('@symfony/webpack-encore');
2
+
3
+Encore
4
+// directory where compiled assets will be stored
5
+    .setOutputPath('public/build/')
6
+    // public path used by the web server to access the output path
7
+    .setPublicPath('/build')
8
+    // only needed for CDN's or sub-directory deploy
9
+    //.setManifestKeyPrefix('build/')
10
+
11
+    // uncomment if you're having problems with a jQuery plugin
12
+    .autoProvidejQuery()
13
+    .autoProvideVariables({
14
+        $: 'jquery',
15
+        jQuery: 'jquery',
16
+        'window.jQuery': 'jquery'
17
+    })
18
+
19
+    /*
20
+     * ENTRY CONFIG
21
+     *
22
+     * Add 1 entry for each "page" of your app
23
+     * (including one that's included on every page - e.g. "app")
24
+     *
25
+     * Each entry will result in one JavaScript file (e.g. app.js)
26
+     * and one CSS file (e.g. app.css) if you JavaScript imports CSS.
27
+     */
28
+    .addEntry('app', './assets/js/app.js')
29
+    .addStyleEntry('appStyle', './assets/css/app.scss')
30
+
31
+    /*
32
+     * FEATURE CONFIG
33
+     *
34
+     * Enable & configure other features below. For a full
35
+     * list of features, see:
36
+     * https://symfony.com/doc/current/frontend.html#adding-more-features
37
+     */
38
+    .cleanupOutputBeforeBuild()
39
+    .enableBuildNotifications()
40
+    .enableSourceMaps(!Encore.isProduction())
41
+    .enableSassLoader(function (sassOptions) {
42
+    }, {resolveUrlLoader: false})
43
+    // enables hashed filenames (e.g. app.abc123.css)
44
+    .enableVersioning(Encore.isProduction())
45
+
46
+    // enables Sass/SCSS support
47
+    .enableSassLoader()
48
+
49
+// uncomment if you use TypeScript
50
+//.enableTypeScriptLoader()
51
+;
52
+
53
+module.exports = Encore.getWebpackConfig();

+ 5502
- 0
yarn.lock
File diff suppressed because it is too large
View File