CategoryLaravel

85% Faster Gulp Builds with Laravel Basset

That’s it! As promised in status update, the latest 1.5 version of Laravel Basset delivers from 85% to 90% improvement in production/optimized/minified build times for your scripts and styles.

Continue reading

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

Laravel Blade directive for conditional HTML classes

Sometimes you need to add classes to HTML elements conditionally, and when you try to do that you almost always end up with messy syntax. Here’s the example in Blade:

<article class="post post-{{ $post->slug }} @if ($post->featured) post-featured @endif @if ($post->sticky) post-sticky @endif">
    ...
</article>

Or with pure PHP:

<article class="post post-<?php echo $post->slug ?> <?php if ($post->featured): ?>post-featured<?php endif ?> <?php if ($post->sticky): ?>post-sticky<?php endif ?>">
    ...
</article>

And if you split it into multi-line you get even worse, and when you add even more conditional classes you get if mess.

Continue reading

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

How to setup Basset in Lumen Application?

Basset now supports Lumen applications also. With just a little setup you can run Basset with all the features as with regular Laravel installation.

Continue reading

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

How to use Font Awesome with Basset?

This article explains how to use third party font icon sets with Basset – better asset management for Laravel.

In this guide, we will include Font Awesome with Bower and use icons in our Laravel application.

Continue reading

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

Basset – auto .min swapping

Normally, for production build, Basset runs UglifyJS to minify JavaScript, and you get pretty good results from minifying with UglifyJS.

Sometimes third party code (like in bower_components) comes with .min files, already minified files. They are most often minified with UglifyJS.

But sometimes libraries, like AngularJS, come with files minified with Google’s Closure Compiler, which can sometimes have even smaller files then UglifyJS (if you specifically optimize your code for Closure Compiler).

And if you use many of those libraries, you can cut down on your build sizes a lot.

Basset can use that. Basset has feature “auto .min swapping” which will try to discover those .min files and use their content instead of normal raw source files. Those .min files will still go through UglifyJS, but the benefits of Closure Compiler, or any other different minifier, will remain there.

So you can just use gulp production build with Bower components and never think about it. Basset will do the rest for you.

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

Basset – asset collections for Laravel

Introducing Laravel Basset (which stands for Better Asset Management) is a Gulp asset building system with integration for Laravel PHP framework.

Laravel Basset is inspired by Basset package for Laravel by Jason Lewis.

It comes with Browserify, ES6, SCSS, LESS, CoffeeScript, Autoprefixer, Livereload and Bower support included.

Continue reading

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

What’s so great about Laravel?

Several people asked me to compare “some PHP framework” with Laravel. Now because I’ve used several frameworks and not every one, I will write in this article what’s so great about Laravel, and you compare it with some other PHP framework that you know.

Continue reading

Share this ...Tweet about this on TwitterShare on FacebookEmail this to someoneShare on RedditShare on Google+Share on LinkedInPin on Pinterest

© 2017 Legacy Blog