承接 mishak/web-resource-management 相关项目开发

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

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

mishak/web-resource-management

最新稳定版本:1.4

Composer 安装命令:

composer require mishak/web-resource-management

包简介

Tools for management of scripts and styles (using Nette Framework)

README 文档

README

Main purpose is to simplify resource management of scripts and styles by moving their definition to configs (of modules) and automated generating of content.

EXPERIMENTAL! BC breaks might occur. This is still more of a draft then proper code so please bear with me.

Installation

Add to your composer.json requirement "mishak/web-resource-management": "dev-master". Directory %WWW_DIR%/generated must be writable by server. Scripts must be under %WWW_DIR%/js directory for now.

Bootstrap

$configurator = new Nette\Config\Configurator;
// after the line above
Mishak\WebResourceManagement\DI\WebResourceManagementExtension::register($configurator);
// before the line bellow
$container = $configurator->createContainer();

In template

<head>
	...
	{include ../../libs/mishak/web-resource-management/@styles.latte}
</head>

<body>
	...
	{include ../../libs/mishak/web-resource-management/@scripts.latte}
</body>

Capabilities

  • dependency management

Scripts

  • translations
  • per script configuration
  • using public, minified and raw version of script based on debugMode and config

Styles

  • support for less (you must have lessc in path)
  • extracting resources to new folders to prevent caching issues using new url
  • renaming file to prevent caching issues
  • generating of gzipped files - can be used by nginx using gzip_static on;

Usage

In config.neon:

resources:

	styles:
		bootstrap:
			filename: %appDir%/../libs/twitter/bootstrap/less/bootstrap.less
		bootstrap.responsive:
			filename: %appDir%/../libs/twitter/bootstrap/less/responsive.less
			depends: bootstrap

	scripts:
		jquery:
			filename: jquery-1.8.2.js
			public: //ajax.googleapis.com/ajax/libs/jquery/1.8.2/jquery.js
		bootstrap:
			filename: bootstrap.js
			minified: bootstrap.min.js
			depends: jquery
		main:
			filename: main.js
			depends: [ jquery, bootstrap ]
  • attribute depends is optional, defaults to empty array ([ ])

Scripts

  • minified version is optional
  • at least filename or public must be defined
  • switching between is done automatically in this order (productionMode = TRUE) public > minified > filename (debugMode = TRUE)

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: BSD-3-Clause
  • 更新时间: 2012-11-17