GithubHelp home page GithubHelp logo

Comments (3)

renestalder avatar renestalder commented on June 2, 2024

Since jQuery is delivered by WordPress itself you'll mostly use this version or stick to a CDN version. In both scenarios you use functions.php to enqueue jQuery, thus making it globally available.

That's why jQuery is shimmed in the package.json of gulp-wp-theme:

{
 "browserify": {
    "transform": [
      "browserify-shim"
    ]
 },
 "browserify-shim": {
    "jQuery": "global:jQuery"
  }
}

This way jQuery will not compile into your JavaScript files, but you are still able to reference it via require statements.

Please note, if you consume the gulp-wp-theme by npm, you may add the shimming to your own package.json.

Further information that might help you:
https://github.com/thlorenz/browserify-shim/wiki/browserify-shim-recipes

from gulp-wp-theme.

colorful-tones avatar colorful-tones commented on June 2, 2024

Ok, so I was not misunderstanding, and want to further clarify that WordPress out-of-box does not automatically enqueue jQuery, but the theme must enqueue WP's jQuery, or CDN. It is available to logged in users, but should be noted that out-of-box it is not available on the front-end for logged out users, therefore has to be enqueue'd in the theme.

You pretty much responded to the same affect @renestalder , and just wanted to restate in case somebody else was confused :-)

Thank you, and appreciate your time!

from gulp-wp-theme.

renestalder avatar renestalder commented on June 2, 2024

Ah, yeah, you are right. It's there because of the admin area, but not automatically in the front-end by default.

from gulp-wp-theme.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.