Skip to content

Commit

Permalink
Fixed paths for styles and scripts in snippet adapter
Browse files Browse the repository at this point in the history
  • Loading branch information
psmyrek committed Nov 4, 2020
1 parent d9e04c6 commit b769fbb
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,7 @@
"svgo": "^1.3.2",
"terser-webpack-plugin": "^3.0.2",
"umberto": "^1.5.4",
"upath": "^2.0.0",
"webpack": "^4.43.0"
},
"engines": {
Expand Down
5 changes: 4 additions & 1 deletion scripts/docs/snippetadapter.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
/* eslint-env node */

const path = require( 'path' );
const upath = require( 'upath' );
const fs = require( 'fs' );
const minimatch = require( 'minimatch' );
const webpack = require( 'webpack' );
Expand Down Expand Up @@ -513,14 +514,16 @@ function readSnippetConfig( snippetSourcePath ) {
}

/**
* Removes duplicated entries specified in `files` array and map those entires using `mapFunction`.
* Removes duplicated entries specified in `files` array, unifies path separators to always be `/`
* and then maps those entries using `mapFunction`.
*
* @param {Array.<String>} files Paths collection.
* @param {Function} mapFunction Function that should return a string.
* @returns {String}
*/
function getHTMLImports( files, mapFunction ) {
return [ ...new Set( files ) ]
.map( path => upath.normalize( path ) )
.map( mapFunction )
.join( '\n' )
.replace( /^\s+/, '' );
Expand Down

0 comments on commit b769fbb

Please sign in to comment.