8000 [Encore] Adding docs about deploying to a subdirectory - see #8069 · medinae/symfony-docs@8b0a22a · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b0a22a

Browse files
committed
[Encore] Adding docs about deploying to a subdirectory - see symfony#8069
1 parent 62dd63e commit 8b0a22a

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed

frontend.rst

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,11 @@ Guides
6161
* :doc:`Adding custom loaders </frontend/encore/custom-loaders>`
6262
* :doc:`Advanced Webpack Configuration </frontend/encore/advanced-config>`
6363

64+
Troubleshooting
65+
...............
66+
67+
* :doc:`FAQ </frontend/encore/faq>`
68+
6469
Full API
6570
........
6671

frontend/encore/faq.rst

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
Frequently Asked Questions
2+
==========================
3+
4+
My App Lives under a Subdirectory
5+
---------------------------------
6+
7+
My app doesn't live at the root of my web server: it lives under a subdirectory
8+
(e.g. ``/myAppSubdir/``). How can I configure Encore to work?
9+
10+
If your app lives under a subdirectory, you just need to include that when calling
11+
``Encore.setPublicPrefix()``:
12+
13+
.. code-block:: diff
14+
15+
// webpack.config.js
16+
Encore
17+
// ...
18+
19+
.setOutputPath('web/build/')
20+
21+
- .setPublicPath('/build')
22+
+ // this is your *true* public path
23+
+ .setPublicPath('/myAppSubdir/build')
24+
25+
+ // this is now needed so that your manifest.json keys are still `build/foo.js`
26+
+ // i.e. you won't need to change anything in your Symfony app
27+
+ config.setManifestKeyPrefix('build')
28+
;
29+
30+
If you're :ref:`processing your assets through manifest.json <load-manifest-files>`,
31+
you're done! The ``manifest.json`` file will now include the subdirectory in the
32+
final paths:
33+
34+
.. code-block:: json
35+
36+
{
37+
"build/app.js": "/myAppSubdir/build/app.123abc.js",
38+
"build/dashboard.css": "/myAppSubdir/build/dashboard.a4bf2d.css"
39+
}

0 commit comments

Comments
 (0)
0