|
|
@@ -16,12 +16,18 @@ const BabelMinifyPlugin = require( 'babel-minify-webpack-plugin' );
|
|
|
module.exports = function snippetAdapter( data ) {
|
|
|
const snippetConfig = readSnippetConfig( data.snippetSource.js );
|
|
|
const outputPath = path.join( data.outputPath, data.snippetPath );
|
|
|
+ let sassImportPath;
|
|
|
+
|
|
|
+ if ( snippetConfig.sassImportPath ) {
|
|
|
+ sassImportPath = path.join( path.dirname( data.snippetSource.js ), snippetConfig.sassImportPath );
|
|
|
+ }
|
|
|
|
|
|
const webpackConfig = getWebpackConfig( {
|
|
|
entry: data.snippetSource.js,
|
|
|
outputPath,
|
|
|
language: snippetConfig.language,
|
|
|
- minify: data.options.production
|
|
|
+ minify: data.options.production,
|
|
|
+ sassImportPath
|
|
|
} );
|
|
|
|
|
|
return runWebpack( webpackConfig )
|
|
|
@@ -107,7 +113,12 @@ function getWebpackConfig( config ) {
|
|
|
minimize: config.minify
|
|
|
}
|
|
|
},
|
|
|
- 'sass-loader'
|
|
|
+ {
|
|
|
+ loader: 'sass-loader',
|
|
|
+ options: {
|
|
|
+ data: config.sassImportPath ? `@import '${ config.sassImportPath }';` : ''
|
|
|
+ }
|
|
|
+ }
|
|
|
]
|
|
|
} )
|
|
|
}
|