Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

SitePoint PHP Blog:
Getting Started with Assetic
Apr 14, 2014 @ 15:37:00

The SitePoint PHP blog has a new post from Lukas White today looking at the Assetic asset management library and how you can get started using it in your application.

There was a time when asset management meant little more than inserting a <link> tag or two and a couple of <script> tags into your HTML. Nowadays, though, that approach just won’t cut it. There’s performance, for one thing. [...] Also, as client-side applications have become more and more sophisticated, managing dependencies amongst scripts and libraries has become increasingly complex. Furthermore, technologies such as Less, Compass and Coffeescript require assets to be compiled, adding yet another step to the process of managing assets. In this article I’m going to look at a PHP package called Assetic which helps manage, compile and optimize assets such as scripts, stylesheets and images.

He briefly discusses asset management first, just to get everyone on the same page as far as what "assets" are and some considerations about their use. Next is an introduction to the Assetic library itself and the install/usage of a simple "AssetCollection" object. He also shows how to add assets to the object and how to configure compression and generation of the files (like with LESS). He also shows how to use the AssetManager and FilterManager object types along with the AssetFactory handler. Finally, he talks about some of the sample output and caching the tool can do with file-based cache handling.

tagged: assetic introduction asset tutorial javascript css less compress

Link: http://www.sitepoint.com/getting-started-assetic

ScreenFony.com:
Work with bootstrap, assetic and less
Sep 25, 2012 @ 15:36:20

On the ScreenFony.com site there's a quick tutorial showing you how to get started with Symfony2+Twitter Bootstrap+Assetic+LESS in a basic application. Assetic is a library that helps with asset management and use and LESS is a CSS pre-processor that makes it simpler to work with your site's CSS.

Bootstrap is a well known and powerful front-end framework for fast prototyping, it uses LESS and it can be easily integrate in your Symfony applications with the help of assetic. In this post I’ll show how to: Install bootstrap in you Symfony application, load it using assetic, and compile bootstrap LESS files with lessphp.

Using Composer, creating a new Symfony2 project is just a single command away. The just update the "composer.json" and run the install to get the other needed libraries (LESS and the Twitter Bootstrap). They help you set up some Assetic filters for LESS and provide a simple page to output the Bootstrap in your header.

tagged: symfony2 assetic twitter bootstrap less css tutorial composer

Link:

DZone.com:
Assetic: JavaScript and CSS files management
Aug 05, 2011 @ 14:19:26

On DZone.com today Giorgio Sironi introduces you to Assetic, an asset management tool that helps you keep things organized and easily requested by your application.

Assetic is a PHP library for managing the deployment of your assets: JavaScript, CSS and other resources which will be requested by the browser. The library has been created by Kris Wallsmith from OpenSky, an e-shop where many of the active members of the PHP community work, or worked (see Jonathan Wage/Doctrine 1 and Bulat Shakirzyanov/Imagine.)

Giorgio compares it to the more traditional method (putting them in a public folder) and how Assetic gives you an advantage over this setup. The main feature of the tool is to bundle all of your assets into one file that is then sent to the browser and interpreted there reducing the need for HTTP calls to request multiple files. An example is included showing the creation of an asset collection and the output of the files all combined into one string.

tagged: assetic asset management css javascript public organize

Link:

Sftuts.com:
Using Assetic in Symfony2 for CSS compression
Apr 19, 2011 @ 16:55:33

On Sftuts.com today Albert Jessurum has taken a look at Assetic, a tool included in the upcoming Symfony2 framework, as a means for compressing the CSS on a site. It's a simple four-step process and he includes each command you'll need along the way.

Symfony Standard comes bundled with a great library called Assetic for Assets Management in PHP 5.3 (CSS, js, and even image optimization coming soon) developed by Kris Wallsmith. We will be using it to compress our CSS files, thus reducing the time required to download stylesheets in our Symfony2 projects.

The steps are pretty simple (especially if you're at all familiar with Symfony):

  • Install the YUI Compressor
  • Change the way you call your assets
  • Edit your configuration file
  • Dump your assets for production

You'll need to have an installation of Symfony2 already set up and running - there's no steps included on that setup.

tagged: assetic symfony css compression

Link:


Trending Topics: