8000 Various Encore updates by weaverryan · Pull Request #8084 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Various Encore updates #8084

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 26, 2017
Prev Previous commit
Next Next commit
[Encore] Adding docs about deploying to a subdirectory - see #8069
  • Loading branch information
weaverryan committed Jun 25, 2017
commit 8b0a22afb9310dec7e0834da57d58cdfeae60312
5 changes: 5 additions & 0 deletions frontend.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@ Guides
* :doc:`Adding custom loaders </frontend/encore/custom-loaders>`
* :doc:`Advanced Webpack Configuration </frontend/encore/advanced-config>`

Troubleshooting
...............

* :doc:`FAQ </frontend/encore/faq>`

Full API
........

Expand Down
39 changes: 39 additions & 0 deletions frontend/encore/faq.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
Frequently Asked Questions
==========================

My App Lives under a Subdirectory
---------------------------------

My app doesn't live at the root of my web server: it lives under a subdirectory
(e.g. ``/myAppSubdir/``). How can I configure Encore to work?

If your app lives under a subdirectory, you just need to include that when calling
``Encore.setPublicPrefix()``:

.. code-block:: diff

// webpack.config.js
Encore
// ...

.setOutputPath('web/build/')

- .setPublicPath('/build')
+ // this is your *true* public path
+ .setPublicPath('/myAppSubdir/build')

+ // this is now needed so that your manifest.json keys are still `build/foo.js`
+ // i.e. you won't need to change anything in your Symfony app
+ config.setManifestKeyPrefix('build')
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

config should not be here, as you add this in a chain call (and there is no config variable)

;

If you're :ref:`processing your assets through manifest.json <load-manifest-files>`,
you're done! The ``manifest.json`` file will now include the subdirectory in the
final paths:

.. code-block:: json

{
"build/app.js": "/myAppSubdir/build/app.123abc.js",
"build/dashboard.css": "/myAppSubdir/build/dashboard.a4bf2d.css"
}
0