定制 andrewhaine/silverstripe-webpack-theme 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

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

andrewhaine/silverstripe-webpack-theme

Composer 安装命令:

composer require andrewhaine/silverstripe-webpack-theme

包简介

Base SilverStripe theme with a webpack build system

README 文档

README

Installation

Composer

This theme can be installed through composer, simply add the following line to your project's composer.json file.

require: "andrewhaine/silverstripe-webpack-theme": "~2.0"

If you are installing with composer it is advisable to remove the above option from your composer.json file after the initial installation in order to avoid installing duplicate themes or overriding your changes.

Manual Installation

Copy this theme into a subdirectory of your themes folder.

Usage

This theme is designed to optimise your production build by minifying assets and optimising images. Any assets referenced (explicitly or implicitly) in index.js will be compiled.

CSS

This theme supports both SCSS and Sass syntax.

The recommended entry point for all CSS is sass/style.sass, any files imported will be bundled into a single CSS file which can be included in the way you choose (Requirements API, link tag etc..).

The setup will also produce an editor.css file which is used by SilverStripe to style the TinyMCE fields in the CMS, styles imported into sass/editor.sass will be included in this file.

Linting

Linting is available from stylelint for SCSS and Sass files, the rules for the linter can be updated in .stylelintrc.yml. A full list of rules can be found here.

JavaScript

Javascript is included in the bundle in much the same way as CSS, the entry point for javascript in this theme is javascript/src/main.js.

The theme comes set up for development using ES6 Syntax but this can be adjusted accordingly by installing babel presets and changing the settings in .eslintrc.yml.

Images

Any images imported into the bundle, either directly or through a URL reference will be optimised, where possible files will be inlined using Data URIs, if an image is above 10kb it will be compressed using the image-webpack-loader and placed in the images directory (Names and extensions are preserved). Images need to be placed in the 'images' directory.

By default image compression is disabled for performance purposes - when the time comes to bundle images for production this can be re-enabled with the disable option in webpack.common.babel.js.

Development

In order to use the watch task you will need to tell webpack which url it should proxy when creating the development server - this is the development url you are using for your project. This option can be set in variables.js.

The build system uses webpack dev server which allows hot reloading for speedy testing. To start the server run npm run watch. The server will start on port 3000 you will also get a nice terminal interface courtesy of FormidableLabs.

With the server started you should then see your site updating live on localhost:3000 when any asset files are changed.

Once development is complete eject your css and minify the bundle using npm run build. This will create the main CSS file (css/main.css) and your JS bundle (javascript/dist/main.bundle.js) which can then be included in your templates.

Signature

The system gives the ability to add a signature to the top of your css and js files, to edit the information shown or disable this feature, edit the options in variables.js.

andrewhaine/silverstripe-webpack-theme 适用场景与选型建议

andrewhaine/silverstripe-webpack-theme 是一款 基于 JavaScript 开发的 Composer 扩展包,目前已累计 151 次下载、GitHub Stars 达 8, 最近一次更新时间为 2017 年 07 月 29 日, 在 PHP 生态内属于活跃度较高的组件。

它主要适用于以下技术方向: 「silverstripe」 「webpack」 「webpack theme」 「silverstripe webpack」 「blank theme」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

我们在过去多个企业项目中使用过 andrewhaine/silverstripe-webpack-theme 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 andrewhaine/silverstripe-webpack-theme 我们能提供哪些服务?
定制开发 / 二次开发

基于 andrewhaine/silverstripe-webpack-theme 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

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

GitHub 信息

  • Stars: 8
  • Watchers: 4
  • Forks: 1
  • 开发语言: JavaScript

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2017-07-29