Skip to content

Commit

Permalink
Use singular name
Browse files Browse the repository at this point in the history
  • Loading branch information
simison committed Aug 22, 2018
1 parent 261fc7d commit 052349f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion bin/sdk/gutenberg.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ exports.config = ( {
} ) => {
const baseConfig = getBaseConfig( {
externalizeWordPressPackages: true,
stylesNamespacing: 'calypso',
styleNamespace: 'calypso',
} );
const name = path.basename( path.dirname( editorScript ).replace( /\/$/, '' ) );

Expand Down
19 changes: 8 additions & 11 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,7 @@ const preSassLoaders = [
{
loader: 'postcss-loader',
options: {
plugins: _.compact( [
require( 'autoprefixer' ),
! isDevelopment && require( 'cssnano' ),
] ),
plugins: _.compact( [ require( 'autoprefixer' ), ! isDevelopment && require( 'cssnano' ) ] ),
},
},
];
Expand All @@ -96,7 +93,7 @@ const sassLoader = {
};

// When styles-namespacing is enabled, these are the files we want to namespace
const stylesNamespacingDirectories = [ path.join( __dirname, 'client', 'components' ) ];
const styleNamespaceDirectories = [ path.join( __dirname, 'client', 'components' ) ];

/**
* Converts @wordpress require into window reference
Expand Down Expand Up @@ -133,11 +130,11 @@ const wordpressExternals = ( context, request, callback ) =>
*
* @param {object} env environment options
* @param {boolean} env.externalizeWordPressPackages whether to bundle or extern the `@wordpress/` packages
* @param {string} env.stylesNamespacing prefix Calypso component styles with CSS class or ID
* @param {string} env.styleNamespace prefix Calypso component styles with CSS class or ID
*
* @return {object} webpack config
*/
function getWebpackConfig( { externalizeWordPressPackages = false, stylesNamespacing = '' } = {} ) {
function getWebpackConfig( { externalizeWordPressPackages = false, styleNamespace = '' } = {} ) {
const webpackConfig = {
bail: ! isDevelopment,
context: __dirname,
Expand Down Expand Up @@ -205,16 +202,16 @@ function getWebpackConfig( { externalizeWordPressPackages = false, stylesNamespa
test: /\.(sc|sa|c)ss$/,
use: [ ...preSassLoaders, sassLoader ],
// When styles-namespacing is enabled, these files are handled by separate loader below
...( stylesNamespacing ? { exclude: stylesNamespacingDirectories } : {} ),
...( styleNamespace ? { exclude: styleNamespaceDirectories } : {} ),
},
stylesNamespacing && {
styleNamespace && {
test: /\.(sc|sa|c)ss$/,
include: stylesNamespacingDirectories,
include: styleNamespaceDirectories,
use: [
...preSassLoaders,
{
loader: 'namespace-css-loader',
options: `.${ stylesNamespacing }`,
options: `.${ styleNamespace }`,
},
sassLoader,
],
Expand Down

0 comments on commit 052349f

Please sign in to comment.