Skip to content

Commit f08d76d

Browse files
committed
Add some custom encore managment such as image asset handling
yarn add file-loader --dev # Build yarn yarn encore dev
1 parent e40b851 commit f08d76d

File tree

4 files changed

+21
-2
lines changed

4 files changed

+21
-2
lines changed

package.json

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
"@symfony/stimulus-bridge": "^2.0.0",
44
"@symfony/webpack-encore": "^1.1.2",
55
"core-js": "^3.0.0",
6+
"file-loader": "^6.2.0",
67
"regenerator-runtime": "^0.13.2",
78
"stimulus": "^2.0.0",
89
"webpack-notifier": "^1.6.0"

templates/base.html.twig

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,11 @@
66
{# Run `composer require symfony/webpack-encore-bundle`
77
and uncomment the following Encore helpers to start using Symfony UX #}
88
{% block stylesheets %}
9-
{#{{ encore_entry_link_tags('app') }}#}
9+
{{ encore_entry_link_tags('app') }}
1010
{% endblock %}
1111

1212
{% block javascripts %}
13-
{#{{ encore_entry_script_tags('app') }}#}
13+
{{ encore_entry_script_tags('app') }}
1414
{% endblock %}
1515
</head>
1616
<body>

webpack.config.js

+10
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,16 @@ Encore
7070

7171
// uncomment if you're having problems with a jQuery plugin
7272
//.autoProvidejQuery()
73+
74+
.copyFiles({
75+
from: './assets/images',
76+
77+
// optional target path, relative to the output dir
78+
to: 'images/[path][name].[ext]',
79+
//
80+
// only copy files matching this pattern
81+
//pattern: /\.(png|jpg|jpeg)$/
82+
})
7383
;
7484

7585
module.exports = Encore.getWebpackConfig();

yarn.lock

+8
Original file line numberDiff line numberDiff line change
@@ -2457,6 +2457,14 @@ faye-websocket@^0.11.3:
24572457
dependencies:
24582458
websocket-driver ">=0.5.1"
24592459

2460+
file-loader@^6.2.0:
2461+
version "6.2.0"
2462+
resolved "https://registry.yarnpkg.com/file-loader/-/file-loader-6.2.0.tgz#baef7cf8e1840df325e4390b4484879480eebe4d"
2463+
integrity sha512-qo3glqyTa61Ytg4u73GultjHGjdRyig3tG6lPtyX/jOEJvHif9uB0/OCI2Kif6ctF3caQTW2G5gym21oAsI4pw==
2464+
dependencies:
2465+
loader-utils "^2.0.0"
2466+
schema-utils "^3.0.0"
2467+
24602468
fill-range@^7.0.1:
24612469
version "7.0.1"
24622470
resolved "https://registry.yarnpkg.com/fill-range/-/fill-range-7.0.1.tgz#1919a6a7c75fe38b2c7c77e5198535da9acdda40"

0 commit comments

Comments
 (0)