bradstinson / assets Goto Github PK
View Code? Open in Web Editor NEWA simple assets library that combines, minifies, and caches CSS, JS, Less, and CoffeeScript assets on the fly.
A simple assets library that combines, minifies, and caches CSS, JS, Less, and CoffeeScript assets on the fly.
There should be extension for loading external files ๐
Please add a method to specify a CSS preprocessor callback.
This is what I do with Casset:
Casset::set_post_load_callback(function($content, $filename) {
if (pathinfo($filename, PATHINFO_EXTENSION) !== 'less') {
return $content;
} else {
$less = new lessc();
$less->addImportDir(ASSETS_PATH.'/stylesheets/import');
return $less->compile($content);
}
});
Super clean and useful class!
I have one performance issue, in the "renderAssets" method you create the minify object in the beginning. Also the $last_modified is created. But in case we want to serve the static file these objects are unnecessary and bad from performance.
Just from a performance perspective, wouldn't it be better to do only the absolute necessary to deliver the static file, and in case that one is missing create the objects needed to do that?
all the best // johannes
Tonight I ran into an issue where the permissions for my cache folder are incorrect, and it caused the following error:
Fatal error: Class 'Assets\Minify\MinifyException' not found in /var/www/html/hosting/vendor/bradstinson/assets/src/Minify/Minify.php on line 106
I was able to solve the underlying problem of the permissions, but I thought you'd like to know this isn't calling the class properly. I haven't had time to go back and fix it myself, but thought it should be recorded in case someone has the time to fix it before I get back to it.
Perhaps I am doing something wrong, but shouldn't this stuff load through the composer autoload?
I have added your project to my composer.json, ran update. Now however I can't get your class to load. I can see it was added to the classmap, but still can't get it to load. Was wondering if you might be able to suggest what I am doing wrong.
Thanks!
Just a small typo in readme.md, on lines 127,132
Assets::setPath('public/assets/')); //There is additional )
Assets::setBaseurl('/')); //And here too
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.