jacobbuck/silverstripe-manifestassets

This package is abandoned and no longer maintained. No replacement package was suggested.
There is no license information available for the latest version (1.0.0) of this package.

Get the path of an asset from a generated assets manifest file.

Installs: 6 102

Dependents: 0

Suggesters: 0

Security: 0

Stars: 1

Watchers: 1

Forks: 1

Open Issues: 0

Type:silverstripe-module

1.0.0 2017-05-26 01:03 UTC

This package is not auto-updated.

Last update: 2022-08-06 17:03:33 UTC


README

Get the path of an asset from a generated assets manifest file.

Usage

In your template you can get the url to your asset:

<script src="$ManifestAsset('awesome.js')" type="application/javascript"></script>

It also works with Requirements:

<% require js($ManifestAsset('awesome.js')) %>

To get the url to your asset in PHP:

$pathToAwesomeJs = ManifestAssets::getPath('awesome.js');

Configuration

In your site config, you'll must configure a base path to your assets manifest file:

ManifestAssets:
  base_path: themes/awesome/dist/js

By default it looks for a manifest.json file, but if you have a different name:

ManifestAssets:
  base_path: themes/awesome/dist/js
  file_name: assets.json

Requirements

  • Silverstripe 3+

Installation

The recommended way to install is through Composer:

composer require jacobbuck/silverstripe-manifestassets