diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..02f54d8
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,21 @@
+MIT License
+
+Copyright (c) 2017 Chrristopher Darling
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in all
+copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..b66961c
--- /dev/null
+++ b/README.md
@@ -0,0 +1,26 @@
+# Theme Manifest assets
+
+loads a JSON manifest file from {theme}/dist/assets.json, looks up a given path and outputs the hashed filename
+
+## Example
+
+### Folder structure
+dist/
+ - *subfolders*
+ - assets.json
+
+### assets.json
+```
+{
+ 'img/logo.png': 'img/logo_HASH.png'
+}
+```
+
+### .ss template
+```
+
+```
+Will output
+```
+
+```
diff --git a/_config.php b/_config.php
new file mode 100644
index 0000000..e69de29
diff --git a/code/ThemeManifestAsset.php b/code/ThemeManifestAsset.php
new file mode 100644
index 0000000..38d994b
--- /dev/null
+++ b/code/ThemeManifestAsset.php
@@ -0,0 +1,45 @@
+ 'getPath',
+ );
+ }
+
+ private static $manifest_files_cache = null;
+
+ private static function getManifestFiles()
+ {
+ if (null === self::$manifest_files_cache) {
+ $manifest = SSViewer::get_theme_folder() . '/dist/assets.json';
+ $absPath = Director::getAbsFile($manifest);
+
+ if (file_exists($absPath)) {
+ $contents = json_decode(file_get_contents($absPath), true);
+
+ self::$manifest_files_cache[] = $contents;
+ }
+ }
+
+ return self::$manifest_files_cache;
+ }
+
+ public static function getPath($path) {
+ if ($manifests = self::getManifestFiles()):
+ foreach ($manifests as $manifest => $map):
+ if (isset($map[$path])) {
+ return SSViewer::get_theme_folder() . '/dist/' . $map[$path];
+ }
+ endforeach;
+ endif;
+
+ return false;
+ }
+}
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..0b4be12
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,24 @@
+{
+ "name": "christopherdarling/silverstripe-theme-manifest-assets",
+ "description": "Loads theme assets from a JSON manifest produced from a build tool like Webpack",
+ "type": "silverstripe-module",
+ "keywords": ["silverstripe", "manifest", "asset", "theme", "webpack"],
+ "license": "MIT",
+ "authors": [
+ {
+ "name": "Christopher Darling",
+ "homepage": "http://www.christopherdarling.co.uk",
+ "role": "Developer"
+ }
+ ],
+ "require": {
+ "silverstripe/framework": ">=3.0.1",
+ "composer/installers": "*"
+ },
+ "support": {
+ "issues": "https://github.com/christopherdarling/silverstripe-theme-manifest-assets"
+ },
+ "extra": {
+ "installer-name": "cd_silverstripe-theme-manifest-assets"
+ }
+}