Weave Code
Weaver
Helps Laravel developers discover, compare, and choose open-source packages. See popularity, security, maintainers, and scores at a glance to make better decisions.
Feedback
Share your thoughts, report bugs, or suggest improvements.
Subject
Message

Tlassets Bundle Laravel Package

electrotiti/tlassets-bundle

View on GitHub
Deep Wiki
Context7

tlassets-bundle

Build Status

TlAssetsBundle is an alternative to Assetic, it build your assets using NodeJS, GULP and custom Twig tags on a Symfony2 project.

WARNING: This bundle is under development, do not use on production.

How it works ?

1:/ In your Twig template, use the tags "style" and "js" to give assets source path and optional filters

2:/ The parser, find all Twig template with these tags and create a JSON buffer file in cache that describe the location of source path, the destination filename and some others options

3:/ The compiler read the buffer files previously created and compile the final assets with GULP

The goal of these two steps (and not one step like assetic does), is to parse your Twig template only when your assets definition change, and compile your assets only when you modify the content of your assets file.

Prerequisites

First you have to install in your environment this tools:

  • Node JS
  • NPM

Installation

Gulp and dependencies

In order to install Gulp and his dependencies, execute command this command :

php app/console tlassets:gulp:install

Tags Twig

Below an example of tags that you can use in your Twig

{% style "@MyCustomBundle/Resources/public/less/" filter="less" %}
  <link rel="stylesheet" href="{{ asset(asset_url) }}" type="text/css" />
{% endstyle %}

{% js "@MyCustomBundle/Resources/public/js/" %}
  <script type="application/javascript" src="{{ asset(asset_url) }}" />
{% endjs %}

Install your assets:

php app/console assets:install

This command (from Symfony), copy your assets from the folder : "src/" to the folder : "web/bundles/"

Quick assets compilation

To compile quickly your assets you just have to do this:

php app/console assets:dump

This command do a tlassets:flush, a tlassets:parse and a tlassets:compile"

Generate your assets step by step

Alternatively (and it's why this bundle is different of Assetic), each task on assets construction can be do separately

Flush previous compilation

php app/console tlassets:flush

This command remove cache and assets previously generated in order to have a clean environment

Parse Twig template

php app/console tlassets:parse

This command parse your Twig template and create a JSON file on the cache directory that will be used by GULP

Compile assets

php app/console tlassets:compile

This command retrieves all file buffer previously created with the parsing command and compile the final assets files

Weaver

How can I help you explore Laravel packages today?

Conversation history is not saved when not logged in.
Prompt
Add packages to context
No packages found.
encore2/laravel-admin2
cboxdk/laravel-console-kit
shapecode/doctrine-dbal-datetimeutc
gilads-otiannoh254/inertia-protocol
dakiquang/laravel-oauth-refresh-lock
woda/laravel-worktrees
dalefranks/ramasite
faghy/laracashbook
roundly-consulting/google-places-for-laravel
roundly-consulting/kubernetes-api-for-laravel
roundly-consulting/plausible-for-laravel
gvp/gvp-laravel-template
metasyncsite/laravel-metasync-client
roundly-consulting/onboarding-for-laravel
adachsoft/cli-process-tester
adachsoft/changelog-linter
adachsoft/collection
adachsoft/php-code-style
adachsoft/api-version-bundle
cgv/localized-resource