Enqueueror

外掛說明

Enqueueror is a plugin assisting WordPress developers in loading JavaScript and CSS code in a well organized and efficient way. The plugin enables WordPress developers to organize script and stylesheet assets in directories, using file naming conventions, enabling the automatic inclusion of the assets depending on the requested content. In addition, Enqueueror supports generating and outputting JavaScript and CSS code using PHP, using the PHP programming language as a preprocessor.

Quick Start Examples

  • Load a stylesheet globally
    Code a CSS file named global.css in the stylesheets directory.

  • Load a stylesheet only when viewing the page with id = 1
    Code a CSS file named type-page-id-1.css or type-id-1.css in the stylesheets directory.

  • Load a stylesheet only when viewing the page with slug = ‘example-page’
    Code a CSS file named type-page-slug-example-page.css or type-slug-example-page.css in the stylesheets directory.

  • Load a stylesheet only when viewing the category term with id = 1
    Code a CSS file named tax-category-term-id-1.css or term-id-1.css in the stylesheets directory.

  • Load a stylesheet only when viewing the category term with slug = ‘category1’
    Code a CSS file named tax-category-term-slug-category1.css or term-slug-category1.css in the stylesheets directory.

Guide

You may read the guide at GitHub

Usage

  • Install Enqueueror
  • Consult the guide at GitHub

螢幕擷圖

  • Enqueue assets globally as external files, regardless of the requested content.
  • Enqueue assets as external files, based on the slug or ID of the page.
  • Enqueue assets as external files, based on the slug or ID of the post.
  • Enqueue assets as external files, based on the slug or ID of content of the "product" post type.
  • Enqueue assets as external files, based on the slug or ID of the content, regardless of the latter's post type.
  • Enqueue assets as external files, based on the slug or ID of a term belonging in the "category" taxonomy.
  • Enqueue assets as external files, when an arbitrary term in the "category" taxonomy is requested.
  • Enqueue assets as external files, based on the slug or ID of a specific term in the "product_cat" taxonomy.
  • Organize assets in directories by post type and taxonomy.
  • Enqueue assets as external files, when the Greek (WPML based) translation of an arbitrary page is requested.
  • Dynamically generate CSS and JavaScript code to be enqueued as external files, for every requested page, using PHP as a preprocessor.
  • Enqueue JavaScript assets as external files, specifying that their script tags should be outputted in the body HTML section, for every requested page.
  • Outputting JavaScript code contained in the .js file as raw code (internally) in the body HTML section, for every requested page.
  • Outputting code contained in the .js and .css files as raw code (internally) in the head HTML section, for every requested page.
  • Dynamically generate CSS & JavaScript code to be outputted as raw code (internally) in the head HTML section, for every requested page.
  • Mix of scenarios.

使用者評論

2022 年 1 月 10 日
Helped me a lot with the css/js organization. I was struggling for years trying to set everything up properly without a solution. I was writing the whole css code at style.css so I had to set different classes for each element at the whole website. Now I am creating a different file for each page so I have things more organized and working more effectively. Very useful plugin.
閱讀全部 2 則使用者評論

參與者及開發者

以下人員參與了開源軟體〈Enqueueror〉的開發相關工作。

參與者

將〈Enqueueror〉外掛本地化為台灣繁體中文版

對開發相關資訊感興趣?

任何人均可瀏覽程式碼、查看 SVN 存放庫,或透過 RSS 訂閱開發記錄

變更記錄

1.2.0

  • Added: Local assets and external script and stylesheets may be used as dependencies.
  • Added: Direct access to PHP preprocessed assets is prevented using .htaccess rules.
  • Changed: Preprocessed assets are now served from /wp-content/uploads/enqueueror.

1.1.1

  • Fixed: Handling of multiple dependencies.

1.1.0

  • Added: Introduced support for header in assets.
  • Added: Introduced support for asset dependencies.
  • Fixed: Asset order rules not always respected.
  • Fixed: Error if WPML is activated but not set up.

1.0.0

  • First release