Skip to content

Commit

Permalink
fallback to default files if no manifest found
Browse files Browse the repository at this point in the history
  • Loading branch information
mmintel committed Apr 14, 2018
1 parent 2966397 commit e50c028
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
6 changes: 3 additions & 3 deletions AssetManifestTags.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ class AssetManifestTags extends Tags
use AssetManifestTrait;

/**
* The {{ laravel_mix }} tag - outputs the revision manifest file as JSON.
* The {{ asset_manifest }} tag - outputs the revision manifest file as JSON.
*
* @return string
*/
Expand All @@ -19,7 +19,7 @@ public function index()
}

/**
* The {{ laravel_mix:css }} tag - outputs the URL or tag for the theme's main CSS file.
* The {{ asset_manifest:css }} tag - outputs the URL or tag for the theme's main CSS file.
*
* @return string
*/
Expand All @@ -35,7 +35,7 @@ public function css()
}

/**
* The {{ laravel_mix:js }} tag - outputs the URL or tag for the theme's main JS file.
* The {{ asset_manifest:js }} tag - outputs the URL or tag for the theme's main JS file.
*
* @return string
*/
Expand Down
3 changes: 1 addition & 2 deletions AssetManifestTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ public function getAssetPath($type)
$src = $this->get('src', Config::get('theming.theme'));
$path = '/' . $type . '/' . Str::ensureRight($src, '.' . $type);
$manifest = $this->getManifest()->get($path);

return $this->themeUrl($manifest);
return $this->themeUrl($manifest ? $manifest : $path);
}

/**
Expand Down
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ A manifest file looks like that:

This addon will not generate this manifest for you, it will just replace your assets. To generate this file you should use a build tool like Gulp, Grunt, Webpack, NPM scripts or whatever.

**If no manifest file was found it will simply load the files without hashes.**

## Importing specific files
The `asset_manifest` tag works exactly like the `theme` tag. So e.g. `{{ asset_manifest:css }}` will import `/css/default.css` and `{{ asset_manifest:css src="test" }}` will import `/css/test.css`.

Expand Down

0 comments on commit e50c028

Please sign in to comment.