siteorigin / laravel-critical-css Goto Github PK
View Code? Open in Web Editor NEWWIP: Critical CSS inliner
WIP: Critical CSS inliner
The goal of this Laravel package is to give a simple middleware that integrates with Critical, a package for calculating critical CSS (CSS for elements above the fold). This is to increase initial page load speed through this technique. It lets a page remove all render blocking CSS, which negatively affects page speed scores.
Our primary goal with this package, versus just adding Critical to our build process, is to give per page critical CSS. This is especially useful for CMS content where each piece of content will have its own critical CSS.
We'll integrate with Laravel through a middleware class. This middleware should do its work after the application has created the response. See: Middleware and Responses.
This is a rough description of the steps involved in this middleware.
The user should be able to configure most of the options for Critical. At least those which are useful for our middleware.
The default value for the input CSS should be public/app.css
.
There might be some additional configuration needed for running Critical on the command line.
We need 100% test coverage for this package, but that shouldn't be too difficult to achieve. We just need to use TestBench to create a simple route and make sure valid CSS is generated.
Our package wont handle the actual deferred loading of CSS. Users will need to handle this themselves using their own Blade templates.
<link rel="preload" href="path/to/mystylesheet.css" as="style" onload="this.onload=null;this.rel='stylesheet'">
<noscript><link rel="stylesheet" href="path/to/stylesheet.css"></noscript>
We also wont strip out any CSS from the original source CSS. This should stay in tact so it's the same across all pages.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.