Skip to content

Commit

Permalink
feat(PremiumComponents): add as Components subdir
Browse files Browse the repository at this point in the history
  • Loading branch information
domtra committed Oct 24, 2019
1 parent 4483e51 commit 0dfde93
Show file tree
Hide file tree
Showing 7 changed files with 6 additions and 22 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/flyntPremium/
/Components/PremiumComponents/
/dist
node_modules
npm-debug.log
Expand Down
3 changes: 0 additions & 3 deletions assets/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,3 @@ function importAll (r) {
}

importAll(require.context('../Components/', true, /admin\.js$/))
if (PREMIUM_COMPONENTS_EXIST) {
importAll(require.context('../flyntPremium/Components/', true, /admin\.js$/))
}
4 changes: 1 addition & 3 deletions assets/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,4 @@
'styles/mixins';

// stylelint-disable-next-line scss/at-import-no-partial-leading-underscore, scss/at-import-partial-extension-blacklist
@import '../Components/*/_admin.scss';
// stylelint-disable-next-line scss/at-import-no-partial-leading-underscore, scss/at-import-partial-extension-blacklist
@import '../FlyntPremium/Components/*/_admin.scss';
@import '../Components/**/_admin.scss';
3 changes: 0 additions & 3 deletions assets/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,3 @@ function importAll (r) {
}

importAll(require.context('../Components/', true, /script\.js$/))
if (PREMIUM_COMPONENTS_EXIST) {
importAll(require.context('../FlyntPremium/Components/', true, /script\.js$/))
}
4 changes: 1 addition & 3 deletions assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,4 @@
'styles/base';

// stylelint-disable-next-line scss/at-import-no-partial-leading-underscore, scss/at-import-partial-extension-blacklist
@import '../Components/*/_style.scss';
// stylelint-disable-next-line scss/at-import-no-partial-leading-underscore, scss/at-import-partial-extension-blacklist
@import '../FlyntPremium/Components/*/_style.scss';
@import '../Components/**/_style.scss';
3 changes: 0 additions & 3 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,4 @@
FileLoader::loadPhpFiles('inc');
add_action('after_setup_theme', ['Flynt\Init', 'initTheme']);
add_action('after_setup_theme', ['Flynt\Init', 'loadComponents'], 101);
if (file_exists(__DIR__ . '/flyntPremium/functions.php')) {
require_once __DIR__ . '/flyntPremium/functions.php';
}
}
9 changes: 3 additions & 6 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
const path = require('path')
const fs = require('fs')
const webpack = require('webpack')
const TerserPlugin = require('terser-webpack-plugin')
const MiniCssExtractPlugin = require('mini-css-extract-plugin')
Expand Down Expand Up @@ -110,16 +109,15 @@ const webpackConfig = {
}
}
}
const premiumComponentsExist = fs.existsSync('flyntPremium/Components')

webpackConfig.plugins = webpackConfig.plugins || []
if (production) {
webpackConfig.plugins.push(
new webpack.DefinePlugin({
PRODUCTION: JSON.stringify(true),
'process.env': {
'NODE_ENV': JSON.stringify('production')
},
PREMIUM_COMPONENTS_EXIST: JSON.stringify(premiumComponentsExist)
}
})
)
webpackConfig.plugins.push(new webpack.optimize.AggressiveMergingPlugin())
Expand All @@ -137,8 +135,7 @@ if (production) {
PRODUCTION: JSON.stringify(false),
'process.env': {
'NODE_ENV': JSON.stringify('development')
},
PREMIUM_COMPONENTS_EXIST: JSON.stringify(premiumComponentsExist)
}
})
)
}
Expand Down

0 comments on commit 0dfde93

Please sign in to comment.