From eaf68b274d57c3ab0d0ac8704100ccf8253206f0 Mon Sep 17 00:00:00 2001
From: "J. Ryan Conklin"
_svg.twig
. See this
- svgs.twig
demo file code comments for implmentation details
- and examples.'
+ 'Store your SVG files in the source/default/static/icons/svg/
+ subdirectory to have them made available via the _svg.twig
.
+ See this svgs.twig
demo file code comments for
+ implmentation details and examples.'
diff --git a/apps/pl-default/patternlab-config.json b/apps/pl-default/patternlab-config.json
index e86361ba83..43a25d593d 100644
--- a/apps/pl-default/patternlab-config.json
+++ b/apps/pl-default/patternlab-config.json
@@ -21,9 +21,30 @@
"tools-docs": false
},
"ishViewportRange": {
- "s": [240, 500, 240, 500, 240, 500],
- "m": [500, 800, 500, 800, 500, 800],
- "l": [800, 2600, 800, 2600, 800, 2600]
+ "s": [
+ 240,
+ 500,
+ 240,
+ 500,
+ 240,
+ 500
+ ],
+ "m": [
+ 500,
+ 800,
+ 500,
+ 800,
+ 500,
+ 800
+ ],
+ "l": [
+ 800,
+ 2600,
+ 800,
+ 2600,
+ 800,
+ 2600
+ ]
},
"logLevel": "error",
"outputFileSuffixes": {
@@ -94,58 +115,96 @@
{
"id": "uikit",
"recursive": true,
- "paths": ["./node_modules/@pattern-lab/uikit-workshop/views-twig"]
+ "paths": [
+ "./node_modules/@pattern-lab/uikit-workshop/views-twig"
+ ]
+ },
+ {
+ "id": "static",
+ "recursive": true,
+ "paths": [
+ "./source/default/static"
+ ]
+ },
+ {
+ "id": "lib",
+ "recursive": true,
+ "paths": [
+ "./source/default/lib"
+ ]
},
{
"id": "protons",
"recursive": true,
- "paths": ["./source/default/_patterns/00-protons"]
+ "paths": [
+ "./source/default/_patterns/00-protons"
+ ]
},
{
"id": "atoms",
"recursive": true,
- "paths": ["source/default/_patterns/01-atoms"]
+ "paths": [
+ "source/default/_patterns/01-atoms"
+ ]
},
{
"id": "molecules",
"recursive": true,
- "paths": ["./source/default/_patterns/02-molecules"]
+ "paths": [
+ "./source/default/_patterns/02-molecules"
+ ]
},
{
"id": "organisms",
"recursive": true,
- "paths": ["./source/default/_patterns/03-organisms"]
+ "paths": [
+ "./source/default/_patterns/03-organisms"
+ ]
},
{
"id": "templates",
"recursive": true,
- "paths": ["./source/default/_patterns/04-templates"]
+ "paths": [
+ "./source/default/_patterns/04-templates"
+ ]
},
{
"id": "pages",
"recursive": true,
- "paths": ["./source/default/_patterns/05-pages"]
+ "paths": [
+ "./source/default/_patterns/05-pages"
+ ]
},
{
"id": "demo",
"recursive": true,
- "paths": ["./apps/pl-default/pattern-lab/_patterns/00-protons-demo"]
+ "paths": [
+ "./apps/pl-default/pattern-lab/_patterns/00-protons-demo"
+ ]
},
{
"id": "demos",
"recursive": true,
- "paths": ["./apps/pl-default/pattern-lab/_patterns"]
+ "paths": [
+ "./apps/pl-default/pattern-lab/_patterns"
+ ]
},
{
"id": "macros",
"recursive": true,
- "paths": ["./source/default/_macros"]
+ "paths": [
+ "./source/default/_macros"
+ ]
}
],
"alterTwigEnv": [
{
"file": "./apps/pl-default/pattern-lab/alter-twig.php",
- "functions": ["addFilters", "addFunctions", "addDebug"]
+ "functions": [
+ "addFilters",
+ "addFunctions",
+ "addDebug"
+ ]
}
]
}
diff --git a/package.json b/package.json
index 546a1b7870..7cd6be4f99 100644
--- a/package.json
+++ b/package.json
@@ -30,7 +30,7 @@
"lint": "npm run lint:js; npm run lint:css;",
"fmt:js": "npm run lint:js -- --fix",
"fmt:css": "npm run lint:css -- --fix && prettier --write '**/*.css'",
- "fmt:svg": "svgo -f ./source/default/_patterns/01-atoms/svg/icons --config=./.svgo.yml",
+ "fmt:svg": "svgo -f ./source/default/static/icons/svg --config=./.svgo.yml",
"fmt": "npm run fmt:svg; npm run fmt:js; npm run fmt:css; prettier --write .",
"test:backstop:ref": "node tools/tests/vrt/backstop-example-reference.js",
"test:backstop:test": "node tools/tests/vrt/backstop-example-test.js",
diff --git a/source/default/_patterns/01-atoms/svg/README.md b/source/default/_patterns/01-atoms/svg/README.md
index d3a4feeec1..53c0df792e 100644
--- a/source/default/_patterns/01-atoms/svg/README.md
+++ b/source/default/_patterns/01-atoms/svg/README.md
@@ -8,9 +8,10 @@ by running `npm run fmt:svg` or `npm run fmt`.
## Adding Icons SVG
-To add an Icon SVG to the system, simply add it to `@atoms/svg/icons/` directory
-and run the format command. This format step is **destructive**, so be aware of
-using source control to revert unintended changes.
+To add an Icon SVG to the system, simply add it to
+`source/default/static/icons/svg/` directory and run the format command. This
+format step is **destructive**, so be aware of using source control to revert
+unintended changes.
## Adjusting Formatting Configuration
diff --git a/source/default/_patterns/01-atoms/svg/_svg--embed.twig b/source/default/_patterns/01-atoms/svg/_svg--embed.twig
index 8aaf162cc8..86af18b7d9 100644
--- a/source/default/_patterns/01-atoms/svg/_svg--embed.twig
+++ b/source/default/_patterns/01-atoms/svg/_svg--embed.twig
@@ -5,13 +5,13 @@
*
* Available variables for svg--embed:
* - svg.path [string]: Atomic path to SVG file.
- * Example: '@atoms/svg/icons/person.svg'
+ * Example: paths.svgs ~ '/search.svg'
*/
#}
{% set svg =
{
- path: '@atoms/svg/icons/person.svg'
+ path: paths.svgs ~ '/search.svg'
}|merge(svg)
%}
diff --git a/source/default/_patterns/01-atoms/svg/icons/README.md b/source/default/_patterns/01-atoms/svg/icons/README.md
deleted file mode 100644
index b0c356050d..0000000000
--- a/source/default/_patterns/01-atoms/svg/icons/README.md
+++ /dev/null
@@ -1,16 +0,0 @@
-# SVG Pattern
-
-The SVG is a special pattern in Particle that is designed to allow us to include
-SVG as CSS or inline. Furthermore, this pattern is setup to be optimized as a
-developer step via `npm run fmt:svg` or `npm run fmt`.
-
-## Adding SVG
-
-To add an SVG to the system, simply add it to `@atoms/svg/icons/` directory and
-run the format command. This step is **destructive**, so be aware of using
-source control to revert unintended changes.
-
-## Adjusting Formatting Configuration
-
-This pattern uses [SVGO](https://github.com/svg/svgo) to format and optimize SVG
-files. You can adjust the configuration at Particle's root in `/.svgo.yml`.
diff --git a/source/default/_patterns/01-atoms/svg/icons/menu.svg b/source/default/_patterns/01-atoms/svg/icons/menu.svg
deleted file mode 100644
index d701054c62..0000000000
--- a/source/default/_patterns/01-atoms/svg/icons/menu.svg
+++ /dev/null
@@ -1,3 +0,0 @@
-
diff --git a/source/default/_patterns/01-atoms/svg/index.js b/source/default/_patterns/01-atoms/svg/index.js
index a687dc6fa9..037c589b15 100644
--- a/source/default/_patterns/01-atoms/svg/index.js
+++ b/source/default/_patterns/01-atoms/svg/index.js
@@ -19,7 +19,7 @@ import './_svg--embed.twig';
import './_svg--sprite.twig';
// Import all SVGs into assets/images for reference in CSS/JS bundle
-require.context('./icons', false, /\.svg$/);
+require.context('static/icons/svg', false, /\.svg$/);
// Enable Fontawesome immediately, comment this out if not using FontAwesome
fontawesome();
diff --git a/source/default/static/icons/svg/README.md b/source/default/static/icons/svg/README.md
new file mode 100644
index 0000000000..83f37ddb29
--- /dev/null
+++ b/source/default/static/icons/svg/README.md
@@ -0,0 +1,17 @@
+# SVG Pattern
+
+This SVG directory is a special static assets directory in Particle that is
+designed to allow us to include SVG as CSS or inline. Furthermore, this pattern
+is setup to be optimized as a developer step via `npm run fmt:svg` or
+`npm run fmt`.
+
+## Adding SVG
+
+To add an SVG to the system, simply add it to `/source/urban/static/icons/svg/`
+directory and run the format command. This step is **destructive**, so be aware
+of using source control to revert unintended changes.
+
+## Adjusting Formatting Configuration
+
+This pattern uses [SVGO](https://github.com/svg/svgo) to format and optimize SVG
+files. You can adjust the configuration at Particle's root in `/.svgo.yml`.
diff --git a/source/default/_patterns/01-atoms/svg/icons/chevron-down.svg b/source/default/static/icons/svg/chevron-down.svg
similarity index 52%
rename from source/default/_patterns/01-atoms/svg/icons/chevron-down.svg
rename to source/default/static/icons/svg/chevron-down.svg
index 51e9e65dbc..64cbdb53d9 100644
--- a/source/default/_patterns/01-atoms/svg/icons/chevron-down.svg
+++ b/source/default/static/icons/svg/chevron-down.svg
@@ -1,3 +1,3 @@
-