Code Monkey home page Code Monkey logo

edwin404-laravel-smart-assets's Introduction

Introduction

Laravel assets optimize include cdn, web assets cache buster

Compatible and tested with Laravel 5.1+

Installation

Laravel 5.1+

At composer.json of your Laravel installation, add the following require line:

{
    "require": {
        "edwin404/laravel-smart-assets": "master-dev"
    }
}

Run composer update to add the package to your Laravel app.

At config/app.php, add the Service Provider:

'providers' => [
    // ...
    Edwin404\SmartAssets\Providers\SmartAssetsServiceProvider:class,
]

Quick start

Using with smart-assets

Blade code:

CODE:1

<script src="@assets('path/to/app.js')"></script>
<img src="@assets('path/to/img.png')" />
<link type="text/css" src="@assets('path/to/app.css')" />

will compile to :

CODE:2

<script src="/path/to/app.js?v160909152021"></script>
<img src="/path/to/img.png?v160909132534" />
<link type="text/css" src="/path/to/app.css?v160909133706" />

Use CDN

Copy vender/edwin404/laravel-smart-assets/config/smart-assets.php to config/smart-assets.php

Specify the assets_cdn config

<?php
return [
    // ...
    'assets_cdn' => 'http://cdn.edwin404.com/',
];

CODE:1 will comple to :

<script src="http://cdn.edwin404.com/path/to/app.js?v160909152021"></script>
<img src="http://cdn.edwin404.com/path/to/img.png?v160909132534" />
<link type="text/css" src="http://cdn.edwin404.com/path/to/app.css?v160909133706" />

Support

Found a bug? Please create an issue on the GitHub project page or send a pull request if you have a fix or extension.

You can also send me a message at [email protected] to discuss more obscure matters about the component.

License

Licensed under the The MIT License (MIT). Please see LICENSE for more information.

edwin404-laravel-smart-assets's People

Contributors

feifei8 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.