2017 © Pedro Peláez
 

symfony-bundle assets-manifest-bundle

Symfony bundle for generating asset urls for our new frontend static asset builing tool

image

trikoder/assets-manifest-bundle

Symfony bundle for generating asset urls for our new frontend static asset builing tool

  • Tuesday, July 10, 2018
  • by alenpokos
  • Repository
  • 7 Watchers
  • 0 Stars
  • 0 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

Manifest Asset Bundle

This bundle provides Twig helper for generating urls for static public assets., (*1)

It reads information from simple JSON config file. There is an example file in manifest.json, (*2)

Usage

Bundle provides two Twig functions - manifestAsset and manifestAssetInline., (*3)

mainfestAsset takes 2 parameters:, (*4)

  • asset url in format @BundleName:path/to/asset or namespaced path @BundleName/path/to/asset
  • optional array with options
    • for now only option is: "absolute" => if true function returns absolute URIs

Example usage:, (*5)

<link href="{{ manifestAsset('@AppBundle:css/bundles/home.css') }}" rel="stylesheet" type="text/css">


manifestAssetInline takes 1 parameter:, (*6)

  • asset url in format @BundleName:path/to/asset or namespaced path @BundleName/path/to/asset

It returns the file content of the asset., (*7)

Example usage:, (*8)

<style>{{ manifestAssetInline('@AppBundle:css/bundles/home.css') }}</style>

Using custom Twig namespaces

First, you need to register your Twig namespace:, (*9)

twig:
    paths:
        '%kernel.project_dir%/src/App/Resources': SomeTwigNamepace

Then, you can use :, (*10)

<style>{{ manifestAsset('@SomeTwigNamepace/css/home.css') }}</style>
<style>{{ manifestAssetInline('@SomeTwigNamepace/js/home.js') }}</style>

Note: Twig namespace references does not contain separator : like bundles. See this link for more details., (*11)

Running tests and linter

For running tests and linter, there is a complete docker enviroment with php and all required tools. To setup environment use:, (*12)

bin/dev/docker-compose build
bin/dev/composer install

To run tests (after environment is built):, (*13)

bin/dev/composer test

To run linter:, (*14)

bin/dev/phpcsfixer fix --dry-run .

To automaticaly fix coding standards, just ommit --dry-run parameter., (*15)

Credits

Copyright (C) 2017 Trikoder, (*16)

Authors: Alen Pokos, Damir Brekalo, Krešo Kunjas., (*17)

Contributors: Branimir Đurek, (*18)

License

Package is licensed under MIT License, (*19)

The Versions

10/07 2018

dev-master

9999999-dev

Symfony bundle for generating asset urls for our new frontend static asset builing tool

  Sources   Download

The Requires

 

The Development Requires

by Krešo Kunjas

20/03 2018

v1.0.0

1.0.0.0

Symfony bundle for generating asset urls for our new frontend static asset builing tool

  Sources   Download

The Requires

 

The Development Requires

by Krešo Kunjas