Coder Social home page Coder Social logo

leohmoraes / laravel-page-speed Goto Github PK

View Code? Open in Web Editor NEW

This project forked from renatomarinho/laravel-page-speed

0.0 3.0 0.0 84 KB

Package to optimize your site automatically which results on a 35%+ optimization

License: MIT License

PHP 67.24% HTML 11.94% CSS 18.54% JavaScript 2.28%

laravel-page-speed's Introduction

Laravel Page Speed

Laravel 5.3 Laravel 5.4 Laravel 5.5 Build Status License Total Downloads

Simple package to minify HTML output on demand which results on a 35%+ optimization.

Installation is easy

You can install the package via composer:

$ composer require renatomarinho/laravel-page-speed

Laravel 5.5 and up

You don't have to do anything else, this package uses Package Auto-Discovery's feature, and should be available as soon as you install it via Composer.

Laravel 5.4 or 5.3

Add the Service Provider to your config/app.php: RenatoMarinho\LaravelPageSpeed\ServiceProvider::class

This is required for publishing the configuration file:

php artisan vendor:publish --provider="RenatoMarinho\LaravelPageSpeed\ServiceProvider"

Next, the \RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::class and others - middleware must be registered in the kernel:

//app/Http/Kernel.php

protected $middleware = [
    ...
    \RenatoMarinho\LaravelPageSpeed\Middleware\ElideAttributes::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\InsertDNSPrefetch::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\RemoveComments::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\TrimUrls::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\RemoveQuotes::class,
    \RenatoMarinho\LaravelPageSpeed\Middleware\CollapseWhitespace::class,
]

Before

Before of Laravel Page Speed

After

After of Laravel Page Speed

Roadmap : Filters

Name Description Available
elide_attributes Removes unnecessary attributes in HTML tags YES
insert_dns_prefetch Injects tags in the HEAD to enable the browser to do DNS prefetching YES
remove_quotes Removes unnecessary quotes in HTML tags YES
trim_urls Removes unnecessary prefixes from URLs YES
collapse_whitespace Removes unnecessary whitespace in HTML YES
remove_comments Removes HTML comments YES
combine_css Combines multiple CSS files into one NO
combine_heads Combines multiple elements into one NO
combine_javascript Combines multiple JavaScript files into one NO
dedup_inlined_images Replaces repeated inlined images with JavaScript that loads the data from the first instance of the image NO
defer_javascript Defers the execution of javascript in the HTML NO
pedantic Adds default type attributes to script and style tags that are missing them NO
extend_cache Improves cacheability NO
fallback_rewrite_css_urls Rewrite URLs in CSS even if CSS is not parseable NO
flatten_css_imports Flattens @import rules in CSS by replacing the rule with the contents of the imported resource NO
hint_preload_subresources Inserts link: headers to preload CSS and JavaScript resources NO
inline_css Inlines small external CSS files NO
inline_google_font_css Inlines small font-loading CSS from Google Fonts API NO
inline_import_to_link Inlines style tags comprising only CSS @imports by converting them to an equivalent link NO
inline_javascript Inlines small external Javascript files NO
inline_preview_images Delays original images; serves inlined, low-quality placeholder images until originals are loaded NO
insert_ga Inserts Google Analytics javascript snippet NO
lazyload_images Loads images when they become visible in the client viewport NO
local_storage_cache Loads inlined CSS and image resources into HTML5 local storage whence the client fetches them subsequently rather than the server sending them again NO
make_show_ads_async Converts synchronous Google AdSense tags to asynchronous format NO
make_google_analytics_async Converts synchronous Google Analytics code to load asynchronously NO
move_css_above_scripts Moves CSS Above Scripts NO
move_css_to_head Moves CSS into the element NO
outline_css Moves large inline <style> tags into external files for cacheability NO
outline_javascript Moves large inline <script> tags into external files for cacheability NO
prioritize_critical_css Instruments the page, inlines its critical CSS at the top, and lazily loads the rest NO
resize_mobile_images Just like inline_preview_images, but uses smaller placeholder images for mobile browsers NO
resize_rendered_image_dimensions Resize images to rendered dimensions NO
responsive_images Serve responsive images using the srcset attribute NO
rewrite_css Minifies CSS NO
rewrite_images Rescales, and compresses images; inlines small ones NO
rewrite_javascript Minifies Javascript NO
rewrite_style_attributes Rewrite the CSS in style attributes by applying the configured rewrite_css filter to it NO
rewrite_style_attributes_with_url Rewrite the CSS in style attributes by applying the configured rewrite_css filter to it, but only if the attribute contains the text 'url(' NO
sprite_images Sprites images NO

Testing

$ composer test

Credits

Inspiration

License

The MIT License (MIT). Please see License File for more information.

laravel-page-speed's People

Contributors

renatomarinho avatar joaorobertopb avatar vinkla avatar

Watchers

James Cloos avatar Léo Moraes avatar  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.