castiron/webpackassets-plugin 问题修复 & 功能扩展

解决BUG、新增功能、兼容多环境部署,快速响应你的开发需求

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

castiron/webpackassets-plugin

最新稳定版本:2.0.3

Composer 安装命令:

composer require castiron/webpackassets-plugin

包简介

Webpack hashed files in October CMS

README 文档

README

This plugin for OctoberCMS works in tandem with the node package webpack-assets-manifest (https://github.com/webdeveric/webpack-assets-manifest) to include CSS, JS, and font assets in your site based on a JSON manifest file written to your assets directory. This will allow you to use hashed file names in your built files, and let October pick up the paths effortlessly.

In non-development environments (when the APP_ENV environment variable doesn't equal "dev") these paths get cached so the JSON file isn't read on every request. This cache should be cleared as a part of the deploy process by running php artisan cache:clear.

Installation

composer require castiron/webpackassets-plugin

Quick start

This plugin provides a component called webpackAssets. Include the component in your view and then use the following to include the js/css/fonts (WOFF2 only) in your template (e.g. in a partial, layout, etc.):

[webpackAssets]
==

<!-- include font <link rel="preload"> tags: -->
{{ webpackAssets.tag('unhashed_filename.woff2') | raw }}

<!-- include css <link> tags: -->
{{ webpackAssets.tag('unhashed_filename.css') | raw }}
[webpackAssets]
==

<!-- include js <script> tags: -->
{{ webpackAssets.tag('unhashed_filename.js') | raw }}
{{ webpackAssets.tag('webpack-dev-server.js') | raw }}

Keep in mind that there’s a performance trade-off to preloading too many font assets, so limit your use to only the highest-priority font assets. For the same reason, the plugin will only create tags for the WOFF2 font format. (See “The Critical Request” and “The Web Fonts: Preloaded” for more information.)

Component options

publicFolder (default: "www")

If you are using a public folder in OctoberCMS (you should be!), specify it here. E.g. "www" or "public"

[webpackAssets]
publicFolder = public

assetsFolder (default: "assets")

The path to the folder, relative to your public folder, to which webpack is writing your assets. This corresponds to output.path from your webpack config.

[webpackAssets]
assetsFolder = assets

manifestFilename (default: "manifest.json", must be relative to assetsFolder)

[webpackAssets]
manifestFilename = files.json

Changelog

2.0.3

  • October 1.1 compatible

统计信息

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

GitHub 信息

  • Stars: 6
  • Watchers: 10
  • Forks: 1
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2017-05-18

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固