Download the PHP package newism/craft3-asset-rev without Composer

On this page you can find all versions of the php package newism/craft3-asset-rev. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package craft3-asset-rev

NSM Asset Rev plugin for Craft CMS 3.x

Asset Models

Rev Asset model urls with date modified timestamps. Its simple… just call the function and pass the asset and an optional transform.

Before:

Template: {{ asset.url(transform) }}
Output: https://local.craft3/uploads/biggie.jpg

After:

Template: {{ nsm_rev_asset_url(asset, transform) }}
Output: https://local.craft3/uploads/biggie.1496670969.jpg

Manifest Files

Additionally NSM Asset Rev can check a manifest file for urls and return the marching revved url.

Manifest:

{ "app.css": "app.1e9915c1398b2ba2fcc2.css" }

Before:

Template: {{ url(app.css) }}
Output: https://local.craft3/app.css

After:

Template: {{ nsm_rev_manifest_url('app.css') }}
Output: https://local.craft3/app.1e9915c1398b2ba2fcc2.css

Manifest files will most likely be created from a build process.

Here's some examples:

Note: NSM Asset Rev only supports one level key: value pairs.

Installation

Step 1: Download the Bundle

Open a command console, enter your project directory and execute the following command to download the latest stable version of this bundle:

This command requires you to have Composer installed globally, as explained in the installation chapter of the Composer documentation.

Step 2: Install

Install plugin in the Craft Control Panel under Settings > Plugins.

Usage

Twig template functions

This plugin provides two twig functions.

Asset Models

{{ nsm_rev_asset_url(asset, transform) }}

Manifest Files

{{ nsm_rev_manifest_url(url) }}

Helper

There's actually three twig functions :). The third is a helper that either calls nsm_rev_asset_url or nsm_rev_manifest_url based on the arguments.

If the first argument is an Assetl then nsm_rev_asset_url will be called internally:

Template: {{ nsm_rev_url(asset, transform) }}
Output: https://local.craft3/uploads/biggie.1496670969.jpg

If the first argument is an string model then nsm_rev_manifest_url will be called internally:

Template: {{ nsm_rev_url('app.css') }}
Output: https://local.craft3/app.1e9915c1398b2ba2fcc2.css

Server Configuration

Important: This plugin doesn't actually change the the filename on the server. You'll need to implement rewrite rules in your apache conf or nginx access.

Apache

See: https://github.com/h5bp/server-configs-apache/blob/master/dist/.htaccess#L968-L984

# ----------------------------------------------------------------------
# | Filename-based cache busting                                       |
# ----------------------------------------------------------------------

# If you're not using a build process to manage your filename version
# revving, you might want to consider enabling the following directives
# to route all requests such as `/style.12345.css` to `/style.css`.
#
# To understand why this is important and even a better solution than
# using something like `*.css?v231`, please see:
# http://www.stevesouders.com/blog/2008/08/23/revving-filenames-dont-use-querystring/

# <IfModule mod_rewrite.c>
#     RewriteEngine On
#     RewriteCond %{REQUEST_FILENAME} !-f
#     RewriteRule ^(.+)\.(\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ $1.$3 [L]
# </IfModule>

NGINX

See: https://github.com/h5bp/server-configs-nginx/blob/master/h5bp/location/cache-busting.conf#L1-L10

# Built-in filename-based cache busting

# This will route all requests for /css/style.20120716.css to /css/style.css
# Read also this: github.com/h5bp/html5-boilerplate/wiki/cachebusting
# This is not included by default, because it'd be better if you use the build
# script to manage the file names.
location ~* (.+)\.(?:\d+)\.(bmp|css|cur|gif|ico|jpe?g|js|png|svgz?|webp|webmanifest)$ {
  try_files $uri $1.$2;
}

Plugin Configuration

See ./src/config.php.

Road Map

Some things to do, and ideas for potential features:

1.0

Future

Credits

Brought to you by Newism


All versions of craft3-asset-rev with dependencies

PHP Build Version
Package Version
Requires craftcms/cms Version ^3.0
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package newism/craft3-asset-rev contains the following files

Loading the files please wait ....