承接 wubinworks/module-require-css 相关项目开发

从需求分析到上线部署,全程专人跟进,保证项目质量与交付效率

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

wubinworks/module-require-css

最新稳定版本:1.0.0

Composer 安装命令:

composer require wubinworks/module-require-css

包简介

An extremely simple module that enables Magento 2's ability to use Require Css.

README 文档

README

An extremely simple module that enables Magento 2's ability to use Require Css.
(This module is designed as a dependency for making other modules.)

  • Very useful when you need to load css in .phtml.
  • Dynamically load css.
  • Use inside <head>(eg: load different external css for different stores).

Usage

<script>
// Load a single css in
// [module root]/view/[area]/web/css/example-01.css
// or
// [theme root]/web/css/example-01.css
require(['require-css!css/example-01']);

// Load multiple css.
require([
    'require-css!css/example-02',
    'require-css!css/example-03'
], function () {
    // Code to run when all css loaded successfully.
});

// Load external css. You don't need the .css extension.
require(['require-css!https://some-cdn.tld/styles']);
</script>

How it works

The core part, which is a RequireJS Plugin, is taken from here. When the dependency require-css!css/styles is required, it will inject a link element that contains stylesheet into <head>.

Best used with

wubinworks/HeadContent

Requirements

Magento 2

Installation

composer require wubinworks/module-require-css
Don't forget to run php bin/magento setup:upgrade

统计信息

  • 总下载量: 6
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 0
  • 点击次数: 0
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 0
  • Watchers: 1
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: OSL-3.0
  • 更新时间: 2023-10-08