Skip to content

Commit

Permalink
feat(flyntPremium): prepare external components
Browse files Browse the repository at this point in the history
  • Loading branch information
domtra committed Sep 9, 2019
1 parent 51e9f3c commit 4483e51
Show file tree
Hide file tree
Showing 15 changed files with 33 additions and 178 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/flyntPremium/
/dist
node_modules
npm-debug.log
Expand Down
13 changes: 0 additions & 13 deletions Components/GridContentLists/README.md

This file was deleted.

64 changes: 0 additions & 64 deletions Components/GridContentLists/_style.scss

This file was deleted.

73 changes: 0 additions & 73 deletions Components/GridContentLists/functions.php

This file was deleted.

18 changes: 0 additions & 18 deletions Components/GridContentLists/index.twig

This file was deleted.

Binary file removed Components/GridContentLists/screenshot.png
Binary file not shown.
4 changes: 4 additions & 0 deletions assets/admin.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
/* global PREMIUM_COMPONENTS_EXIST */
import './admin.scss'

function importAll (r) {
r.keys().forEach(r)
}

importAll(require.context('../Components/', true, /admin\.js$/))
if (PREMIUM_COMPONENTS_EXIST) {
importAll(require.context('../flyntPremium/Components/', true, /admin\.js$/))
}
2 changes: 2 additions & 0 deletions assets/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@

// 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';
4 changes: 4 additions & 0 deletions assets/main.js
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* global PREMIUM_COMPONENTS_EXIST */
import 'console-polyfill'
import 'normalize.css/normalize.css'
import './main.scss'
Expand Down Expand Up @@ -25,3 +26,6 @@ function importAll (r) {
}

importAll(require.context('../Components/', true, /script\.js$/))
if (PREMIUM_COMPONENTS_EXIST) {
importAll(require.context('../FlyntPremium/Components/', true, /script\.js$/))
}
2 changes: 2 additions & 0 deletions assets/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,5 @@

// 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';
2 changes: 1 addition & 1 deletion bs-server.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ bundler.plugin('done', function (bundles) {
})
})

function checkAssets(stats, bundleHashes) {
function checkAssets (stats, bundleHashes) {
try {
const changedFiles = Object.keys(stats.compilation.assets)
.filter(name => {
Expand Down
3 changes: 3 additions & 0 deletions functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,7 @@
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';
}
}
1 change: 0 additions & 1 deletion inc/fieldGroups/pageComponents.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
Api::loadFields('BlockWysiwyg', 'layout'),
Api::loadFields('BlockWysiwygTwoCol', 'layout'),
Api::loadFields('BlockWysiwygSidebar', 'layout'),
Api::loadFields('GridContentLists', 'layout'),
Api::loadFields('GridDownloadPortrait', 'layout'),
Api::loadFields('GridImageText', 'layout'),
Api::loadFields('GridListSteps', 'layout'),
Expand Down
14 changes: 9 additions & 5 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@
"start": "check-node-version --package -p && $npm_execpath run clean && node bs-server.js",
"build": "check-node-version --package -p && $npm_execpath run clean && $npm_execpath run lint && NODE_ENV=production webpack --progress --display=minimal && gulp rev",
"lint": "$npm_execpath run lint:scripts && $npm_execpath run lint:styles && $npm_execpath run lint:php",
"lint:scripts": "eslint Components/ assets/",
"lint:styles": "stylelint \"Components/**/*.scss\" \"assets/**/*.scss\"",
"lint:scripts": "eslint '**/*.js'",
"lint:styles": "stylelint '**/*.scss'",
"lint:php": "./vendor/bin/phpcs --standard=phpcs.ruleset.xml",
"lint:scripts:fix": "eslint Components/ assets/ --fix",
"lint:styles:fix": "stylelint \"Components/**/*.scss\" \"assets/**/*.scss\" --fix",
"lint:scripts:fix": "eslint '**/*.js' --fix",
"lint:styles:fix": "stylelint '**/*.scss' --fix",
"lint:php:fix": "./vendor/bin/phpcbf --standard=phpcs.ruleset.xml",
"release": "standard-version -a",
"releaseGithub": "conventional-github-releaser -p angular"
Expand Down Expand Up @@ -104,7 +104,11 @@
"selector-class-pattern": null,
"max-nesting-depth": null,
"selector-max-compound-selectors": 4
}
},
"ignoreFiles": [
"dist/**",
"vendor/**"
]
},
"engines": {
"node": ">=8.0.0"
Expand Down
10 changes: 7 additions & 3 deletions webpack.config.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
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 @@ -109,14 +110,16 @@ 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 @@ -134,7 +137,8 @@ if (production) {
PRODUCTION: JSON.stringify(false),
'process.env': {
'NODE_ENV': JSON.stringify('development')
}
},
PREMIUM_COMPONENTS_EXIST: JSON.stringify(premiumComponentsExist)
})
)
}
Expand All @@ -155,7 +159,7 @@ const multiConfig = Object.keys(config.entry).map(entry => {
// both options are optional
filename: `${entry}.css`,
chunkFilename: `${entry}.css`
}),
})
]
}
})
Expand Down

0 comments on commit 4483e51

Please sign in to comment.