Skip to content

[Encore] Document exposing global variables #8071

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

Closed
weaverryan opened this issue Jun 21, 2017 · 1 comment
Closed

[Encore] Document exposing global variables #8071

weaverryan opened this issue Jun 21, 2017 · 1 comment
Labels
front-end hasPR A Pull Request has already been submitted for this issue.

Comments

@weaverryan
Copy link
Member

In many cases, you may need to do this:

const $ = require('jquery');
window.$ = window.jQuery = $;

so that you can use $ or jQuery outside of a webpack file (e.g. because you have some JS in a template). We need to document this in the "legacy" section.

@stof
Copy link
Member

stof commented Jun 21, 2017

I would recommend this instead:

const $ = require('jquery');
global.$ = global.jQuery = $;

This would let us add window.jQuery again in the autoProvideJquery list, to support bootstrap by default

@weaverryan weaverryan added the hasPR A Pull Request has already been submitted for this issue. label Jun 25, 2017
weaverryan added a commit that referenced this issue Jun 26, 2017
This PR was merged into the 3.3 branch.

Discussion
----------

Various Encore updates

Closes:
* #8053
* #8067
* #8069
* #8071
* #8070
* #8072

Replaces #8083

Commits
-------

15e816e Tweaks thanks to Javier
f8461d3 adding anotehr faq for old packages without a main script
f5c22a6 minor rewording
a0982ec [Encore] Adding more FAQs for #8072
807b83f [Encore] Documenting addPlugin - see #8070
a099bff Documenting (better) how to expose global variables - see #8071
8b0a22a [Encore] Adding docs about deploying to a subdirectory - see #8069
62dd63e Adding docs about adding custom config - see #8067
0ff1c3c Add missing link to handlebars-loader
3d9905e Add docs for custom loaders
weaverryan added a commit that referenced this issue Jun 28, 2017
* 3.4:
  Fixes for #8084 thanks to Stof
  Tweaks thanks to Javier
  Use Twig's namespaced paths
  adding anotehr faq for old packages without a main script
  minor rewording
  [Encore] Adding more FAQs for #8072
  [Encore] Documenting addPlugin - see #8070
  Documenting (better) how to expose global variables - see #8071
  [Encore] Adding docs about deploying to a subdirectory - see #8069
  Adding docs about adding custom config - see #8067
  Add missing link to handlebars-loader
  Add docs for custom loaders
  [#8004] some minor tweaks
  document new framework.assets.json_manifest_path option
  Minor reword
  Clearify setup of basic auth for test environment
  Update workflow.rst
  rearrange how workflow events are presented
  adding note about extracting CSS
  Adding note about browserslist config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
front-end hasPR A Pull Request has already been submitted for this issue.
Projects
None yet
Development

No branches or pull requests

4 participants