定制 oriceon/minify 二次开发

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

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

oriceon/minify

Composer 安装命令:

composer require oriceon/minify

包简介

A package for minifying styles and javascript for laravel 6+

README 文档

README

Build Status Latest Stable Version Total Downloads License

With this package you can minify your existing stylessheet and javascript files for laravel 6+. This process can be a little tough, this package simplies this process and automates it.

Installation

Begin by installing this package through Composer.

composer require oriceon/minify

Publish the config file:

php artisan vendor:publish --provider="Oriceon\Minify\MinifyServiceProvider" --force

Package will auto-discover and you can use this Facade anywhere in your application

Stylesheet

	// app/views/hello.blade.php

	<html>
		<head>
			...
			{!! Minify::stylesheet('/css/main.css') !!}

			// or by passing multiple files
			{!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css')) !!}

			// add custom attributes
			{!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'), array('foo' => 'bar')) !!}

			// add full uri of the resource
			{!! Minify::stylesheet(array('/css/main.css', '/css/bootstrap.css'))->withFullUrl() !!}
		    {!! Minify::stylesheet(array('//fonts.googleapis.com/css?family=Roboto')) !!}

			// minify and combine all stylesheet files in given folder
			{!! Minify::stylesheetDir('/css/') !!}

			// add custom attributes to minify and combine all stylesheet files in given folder
			{!! Minify::stylesheetDir('/css/', array('foo' => 'bar', 'defer' => true)) !!}

			// minify and combine all stylesheet files in given folder with full uri
			{!! Minify::stylesheetDir('/css/')->withFullUrl() !!}
		</head>
		...
	</html>

Javascript

	// app/views/hello.blade.php

	<html>
		<body>
		...
		</body>
		{!! Minify::javascript('/js/jquery.js') !!}

		// or by passing multiple files
		{!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js')) !!}

		// add custom attributes
		{!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'), array('bar' => 'baz')) !!}

		// add full uri of the resource
		{!! Minify::javascript(array('/js/jquery.js', '/js/jquery-ui.js'))->withFullUrl() !!}
        {!! Minify::javascript(array('//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js')) !!}

		// minify and combine all javascript files in given folder
		{!! Minify::javascriptDir('/js/') !!}

		// add custom attributes to minify and combine all javascript files in given folder
		{!! Minify::javascriptDir('/js/', array('bar' => 'baz', 'async' => true)) !!}

		// minify and combine all javascript files in given folder with full uri
		{!! Minify::javascriptDir('/js/')->withFullUrl() !!}
	</html>

Credits to main author

Fwork package : DevFactoryCH/minify

统计信息

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

GitHub 信息

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

其他信息

  • 授权协议: MIT
  • 更新时间: 2020-03-16

承接程序开发

PHP开发

VUE

Vue开发

前端开发

小程序开发

公众号开发

系统定制

数据库设计

云部署

网站建设

安全加固