├── .babelrc ├── .editorconfig ├── .eslintignore ├── .eslintrc.js ├── .gitignore ├── .prettierrc ├── .stylelintrc ├── LICENSE ├── README.md ├── api ├── config.php └── menu.php ├── build ├── build.js ├── check-versions.js ├── dev-client.js ├── dev-server.js ├── prerequisites.js ├── utils.js ├── vue-loader.conf.js ├── webpack.base.conf.js ├── webpack.dev.conf.js ├── webpack.prod.conf.js ├── webpack.test.conf.js ├── wyvern.js └── wyvernConfig.json ├── config ├── dev.env.js ├── index.js ├── prod.env.js └── test.env.js ├── extensions ├── .gitkeep └── options │ ├── README.md │ ├── api.php │ ├── include.php │ ├── script.js │ ├── style.css │ └── template.html ├── functions.php ├── includes ├── acf.php ├── custom.php ├── menus.php ├── routes.php ├── scripts.php ├── sidebars.php ├── support.php └── templates.php ├── index.html ├── index.php ├── logo.png ├── package.json ├── prerender.js ├── screenshot.png ├── screenshot.psd ├── src ├── App.vue ├── api │ ├── config.js │ ├── logger.js │ ├── menus.js │ ├── products.js │ ├── query.js │ └── search.js ├── assets │ ├── _variables.scss │ ├── helpers │ │ └── _noselect.scss │ └── style.scss ├── components │ ├── archive.vue │ ├── index.vue │ ├── page.vue │ ├── partials │ │ ├── gallery.vue │ │ ├── lightbox.vue │ │ ├── menu-location.vue │ │ └── theme-header.vue │ ├── product.vue │ ├── project.vue │ └── single.vue ├── event-bus.js ├── main.js ├── mixins.js ├── plugins │ ├── logger.js │ └── vuex-cache.js ├── router │ ├── index.js │ ├── templates.js │ └── util.js ├── store │ ├── actions.js │ ├── getters.js │ ├── index.js │ ├── modules │ │ ├── lightbox.js │ │ ├── menu.js │ │ ├── product.js │ │ ├── query.js │ │ └── search.js │ └── mutation-types.js └── util.js ├── static └── .gitkeep ├── style.css └── test ├── e2e ├── custom-assertions │ └── elementCount.js ├── nightwatch.conf.js ├── runner.js └── specs │ └── test.js └── unit ├── .eslintrc ├── index.js ├── karma.conf.js └── specs └── Hello.spec.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": [ 3 | ["env", { "modules": false }], 4 | "stage-2" 5 | ], 6 | "plugins": ["transform-runtime"], 7 | "comments": false, 8 | "env": { 9 | "test": { 10 | "presets": ["env", "stage-2"], 11 | "plugins": [ "istanbul" ] 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /.editorconfig: -------------------------------------------------------------------------------- 1 | root = true 2 | 3 | [*] 4 | charset = utf-8 5 | indent_style = space 6 | indent_size = 2 7 | end_of_line = lf 8 | insert_final_newline = true 9 | trim_trailing_whitespace = true 10 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | build/*.js 2 | config/*.js 3 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | // http://eslint.org/docs/user-guide/configuring 2 | 3 | module.exports = { 4 | root: true, 5 | parser: 'babel-eslint', 6 | parserOptions: { 7 | sourceType: 'module' 8 | }, 9 | env: { 10 | browser: true, 11 | }, 12 | extends: 'airbnb-base', 13 | // required to lint *.vue files 14 | plugins: [ 15 | 'html' 16 | ], 17 | // check if imports actually resolve 18 | 'settings': { 19 | 'import/resolver': { 20 | 'webpack': { 21 | 'config': 'build/webpack.base.conf.js' 22 | } 23 | } 24 | }, 25 | // add your custom rules here 26 | 'rules': { 27 | // don't require .vue extension when importing 28 | 'import/extensions': ['error', 'always', { 29 | 'js': 'never', 30 | 'vue': 'never' 31 | }], 32 | // allow optionalDependencies 33 | 'import/no-extraneous-dependencies': ['error', { 34 | 'optionalDependencies': ['test/unit/index.js'] 35 | }], 36 | // allow debugger during development 37 | 'no-debugger': process.env.NODE_ENV === 'production' ? 2 : 0, 38 | // allow snail cased properties in wp 'post_type' 39 | 'camelcase': ['off'], 40 | 'arrow-parens': ['off'] 41 | }, 42 | "globals": { 43 | "_": true, 44 | "apiPromise": true, 45 | "axios": true, 46 | "wp": true, 47 | "config": true 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | .DS_Store 2 | .idea 3 | yarn.lock 4 | node_modules/ 5 | dist/ 6 | npm-debug.log* 7 | yarn-debug.log* 8 | yarn-error.log* 9 | test/unit/coverage 10 | test/e2e/reports 11 | selenium-debug.log 12 | package-lock.json 13 | build/wyvernConfig.json -------------------------------------------------------------------------------- /.prettierrc: -------------------------------------------------------------------------------- 1 | { 2 | "singleQuote": true, 3 | "trailingComma": "all" 4 | } 5 | -------------------------------------------------------------------------------- /.stylelintrc: -------------------------------------------------------------------------------- 1 | { 2 | "rules": { 3 | "at-rule-empty-line-before": [ "always", { 4 | "except": [ "blockless-after-blockless", "first-nested" ], 5 | "ignore": ["after-comment"], 6 | } ], 7 | "block-closing-brace-newline-after": "always", 8 | "block-closing-brace-newline-before": "always-multi-line", 9 | "block-closing-brace-space-before": "always-single-line", 10 | "block-no-empty": true, 11 | "block-opening-brace-newline-after": "always-multi-line", 12 | "block-opening-brace-space-after": "always-single-line", 13 | "block-opening-brace-space-before": "always", 14 | "color-hex-case": [ "lower", { "severity": "warning" } 15 | ], 16 | "color-hex-length": "short", 17 | "color-no-invalid-hex": true, 18 | "comment-empty-line-before": [ "always", { 19 | "except": ["first-nested"], 20 | "ignore": ["stylelint-commands"], 21 | } ], 22 | "comment-whitespace-inside": null, 23 | "declaration-bang-space-after": "never", 24 | "declaration-bang-space-before": "always", 25 | "declaration-block-no-shorthand-property-overrides": true, 26 | "declaration-block-semicolon-newline-after": "always-multi-line", 27 | "declaration-block-semicolon-space-after": "always-single-line", 28 | "declaration-block-semicolon-space-before": "never", 29 | "declaration-block-single-line-max-declarations": 1, 30 | "declaration-block-trailing-semicolon": "always", 31 | "declaration-colon-newline-after": "always-multi-line", 32 | "declaration-colon-space-after": "always-single-line", 33 | "declaration-colon-space-before": "never", 34 | "font-family-name-quotes": "always-unless-keyword", 35 | "function-calc-no-unspaced-operator": true, 36 | "function-comma-newline-after": "always-multi-line", 37 | "function-comma-space-after": "always-single-line", 38 | "function-comma-space-before": "never", 39 | "function-linear-gradient-no-nonstandard-direction": true, 40 | "function-parentheses-newline-inside": "always-multi-line", 41 | "function-parentheses-space-inside": "never-single-line", 42 | "function-whitespace-after": "always", 43 | "indentation": 2, 44 | "length-zero-no-unit": true, 45 | "max-empty-lines": 1, 46 | "media-feature-colon-space-after": "always", 47 | "media-feature-colon-space-before": "never", 48 | "media-feature-parentheses-space-inside": "never", 49 | "media-feature-range-operator-space-after": "always", 50 | "media-feature-range-operator-space-before": "always", 51 | "media-query-list-comma-newline-after": "always-multi-line", 52 | "media-query-list-comma-space-after": "always-single-line", 53 | "media-query-list-comma-space-before": "never", 54 | "no-eol-whitespace": true, 55 | "no-invalid-double-slash-comments": true, 56 | "no-missing-end-of-source-newline": true, 57 | "number-leading-zero": "always", 58 | "number-no-trailing-zeros": true, 59 | "rule-empty-line-before": [ "always-multi-line", { 60 | "ignore": ["after-comment"], 61 | } ], 62 | "selector-combinator-space-after": "always", 63 | "selector-combinator-space-before": "always", 64 | "selector-list-comma-newline-after": "always", 65 | "selector-list-comma-space-before": "never", 66 | "selector-pseudo-element-colon-notation": "double", 67 | "string-no-newline": true, 68 | "string-quotes": "double", 69 | "value-list-comma-newline-after": "always-multi-line", 70 | "value-list-comma-space-after": "always-single-line", 71 | "value-list-comma-space-before": "never", 72 | }, 73 | } -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2017 Made in Sane 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | ![Wyvern](logo.png) 2 | 3 | ![MIT license](https://img.shields.io/badge/license-MIT-blue.svg) 4 | 5 | ## Intro 6 | 7 | Wyvern is Wordpress Vue 2 Rest API based theme boilerplate currently **under construction**. 8 | 9 | ## Documentation 10 | 11 | Visit [documentation online](https://madesane.github.io/wyvern-docs/). 12 | 13 | ## Issues 14 | 15 | Report issues in github repository [issue tracker](https://github.com/madesane/wyvern/issues). We are glad for any sort of feedback. 16 | 17 | ## Contribution 18 | 19 | Feel free to make pull request or report issues. 20 | 21 | ## License 22 | 23 | [MIT](http://opensource.org/licenses/MIT) -------------------------------------------------------------------------------- /api/config.php: -------------------------------------------------------------------------------- 1 | WP_REST_Server::READABLE, 17 | 'callback' => 'wyvern_get_config', 18 | 'args' => [], 19 | ] ); 20 | } ); 21 | 22 | if ( !function_exists('wyvern_get_config') ) 23 | { 24 | function wyvern_get_config($data) 25 | { 26 | return wyvern_theme_config(); 27 | } 28 | } -------------------------------------------------------------------------------- /api/menu.php: -------------------------------------------------------------------------------- 1 | - get menu by id, name or slug 9 | | - /wp-json/wyvern/v1/menu/25 10 | | - /wp-json/wyvern/v1/menu/primary-menu 11 | | /menu/location/ - get menu by location 12 | | - /wp-json/wyvern/v1/menu/location/primary/ 13 | | 14 | */ 15 | 16 | add_action( 'rest_api_init', function () { 17 | // {api base url}/menu/location/ 18 | register_rest_route( 'wyvern/v1', '/menu/location/(?P\S+)', [ 19 | 'methods' => WP_REST_Server::READABLE, 20 | 'callback' => 'wyvern_get_menu_items_by_location', 21 | 'args' => [ 22 | 'location' 23 | ], 24 | ] ); 25 | 26 | // {api base url}/menu/ 27 | register_rest_route( 'wyvern/v1', '/menu/(?P\S+)', [ 28 | 'methods' => WP_REST_Server::READABLE, 29 | 'callback' => 'wyvern_get_menu_items_by_id', 30 | 'args' => [ 31 | 'id' 32 | ], 33 | ] ); 34 | } ); 35 | 36 | if ( !function_exists('wyvern_get_menu_items_by_id') ) 37 | { 38 | function wyvern_get_menu_items_by_id($data) 39 | { 40 | // Check if location was specified 41 | if ( !isset($data['id']) ) 42 | return apply_filters( 'wyvern_get_menu', ['msg' => __('Menu was not specified')]); 43 | 44 | // Array of menu items, otherwise false 45 | $source = wp_get_nav_menu_items($data['id']); 46 | 47 | if ( $source === false ) 48 | return apply_filters( 'wyvern_get_menu', ['msg' => __('Menu has no items')]); 49 | 50 | return apply_filters( 'wyvern_get_menu', $source ); 51 | } 52 | } 53 | 54 | 55 | if ( !function_exists('wyvern_get_menu_items_by_location') ) 56 | { 57 | function wyvern_get_menu_items_by_location($data) 58 | { 59 | // Check if location was specified 60 | if ( !isset($data['location']) ) 61 | return apply_filters( 'wyvern_get_menu', ['msg' => __('Menu location was not specified')]); 62 | 63 | // Get available locations 64 | $available_locations = get_nav_menu_locations(); 65 | 66 | if ( !isset($available_locations[$data['location']]) ) 67 | return apply_filters( 'wyvern_get_menu', ['msg' => __('Specified location has no menu attached to it')]); 68 | 69 | // Array of menu items, otherwise false 70 | $source = wp_get_nav_menu_items($available_locations[$data['location']]); 71 | 72 | if ( $source === false ) 73 | return apply_filters( 'wyvern_get_menu', ['msg' => __('Menu has no items')]); 74 | 75 | return apply_filters( 'wyvern_get_menu', $source ); 76 | } 77 | } 78 | -------------------------------------------------------------------------------- /build/build.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | 3 | process.env.NODE_ENV = 'production' 4 | 5 | var ora = require('ora') 6 | var rm = require('rimraf') 7 | var path = require('path') 8 | var chalk = require('chalk') 9 | var webpack = require('webpack') 10 | var config = require('../config') 11 | var webpackConfig = require('./webpack.prod.conf') 12 | 13 | var spinner = ora('building for production...') 14 | spinner.start() 15 | 16 | rm(path.join(config.build.assetsRoot, config.build.assetsSubDirectory), err => { 17 | if (err) throw err 18 | webpack(webpackConfig, function (err, stats) { 19 | spinner.stop() 20 | if (err) throw err 21 | process.stdout.write(stats.toString({ 22 | colors: true, 23 | modules: false, 24 | children: false, 25 | chunks: false, 26 | chunkModules: false 27 | }) + '\n\n') 28 | 29 | console.log(chalk.cyan(' Build complete.\n')) 30 | console.log(chalk.yellow( 31 | ' Tip: built files are meant to be served over an HTTP server.\n' + 32 | ' Opening index.html over file:// won\'t work.\n' 33 | )) 34 | }) 35 | }) 36 | -------------------------------------------------------------------------------- /build/check-versions.js: -------------------------------------------------------------------------------- 1 | var chalk = require('chalk') 2 | var semver = require('semver') 3 | var packageConfig = require('../package.json') 4 | var shell = require('shelljs') 5 | function exec (cmd) { 6 | return require('child_process').execSync(cmd).toString().trim() 7 | } 8 | 9 | var versionRequirements = [ 10 | { 11 | name: 'node', 12 | currentVersion: semver.clean(process.version), 13 | versionRequirement: packageConfig.engines.node 14 | }, 15 | ] 16 | 17 | if (shell.which('npm')) { 18 | versionRequirements.push({ 19 | name: 'npm', 20 | currentVersion: exec('npm --version'), 21 | versionRequirement: packageConfig.engines.npm 22 | }) 23 | } 24 | 25 | module.exports = function () { 26 | var warnings = [] 27 | for (var i = 0; i < versionRequirements.length; i++) { 28 | var mod = versionRequirements[i] 29 | if (!semver.satisfies(mod.currentVersion, mod.versionRequirement)) { 30 | warnings.push(mod.name + ': ' + 31 | chalk.red(mod.currentVersion) + ' should be ' + 32 | chalk.green(mod.versionRequirement) 33 | ) 34 | } 35 | } 36 | 37 | if (warnings.length) { 38 | console.log('') 39 | console.log(chalk.yellow('To use this template, you must update following to modules:')) 40 | console.log() 41 | for (var i = 0; i < warnings.length; i++) { 42 | var warning = warnings[i] 43 | console.log(' ' + warning) 44 | } 45 | console.log() 46 | process.exit(1) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /build/dev-client.js: -------------------------------------------------------------------------------- 1 | /* eslint-disable */ 2 | require('eventsource-polyfill') 3 | var hotClient = require('webpack-hot-middleware/client?noInfo=true&reload=true') 4 | 5 | hotClient.subscribe(function (event) { 6 | if (event.action === 'reload') { 7 | window.location.reload() 8 | } 9 | }) 10 | -------------------------------------------------------------------------------- /build/dev-server.js: -------------------------------------------------------------------------------- 1 | require('./check-versions')() 2 | require('./prerequisites')(function () { 3 | var config = require('../config') 4 | if (!process.env.NODE_ENV) { 5 | process.env.NODE_ENV = JSON.parse(config.dev.env.NODE_ENV) 6 | } 7 | 8 | var opn = require('opn') 9 | var path = require('path') 10 | var express = require('express') 11 | var webpack = require('webpack') 12 | var proxyMiddleware = require('http-proxy-middleware') 13 | var webpackConfig = process.env.NODE_ENV === 'testing' 14 | ? require('./webpack.prod.conf') 15 | : require('./webpack.dev.conf') 16 | 17 | // default port where dev server listens for incoming traffic 18 | var port = process.env.PORT || config.dev.port 19 | // automatically open browser, if not set will be false 20 | var autoOpenBrowser = !!config.dev.autoOpenBrowser 21 | // Define HTTP proxies to your custom API backend 22 | // https://github.com/chimurai/http-proxy-middleware 23 | var proxyTable = config.dev.proxyTable 24 | 25 | var app = express() 26 | var compiler = webpack(webpackConfig) 27 | 28 | var devMiddleware = require('webpack-dev-middleware')(compiler, { 29 | publicPath: webpackConfig.output.publicPath, 30 | quiet: true 31 | }) 32 | 33 | var hotMiddleware = require('webpack-hot-middleware')(compiler, { 34 | log: () => {} 35 | }) 36 | // force page reload when html-webpack-plugin template changes 37 | compiler.plugin('compilation', function (compilation) { 38 | compilation.plugin('html-webpack-plugin-after-emit', function (data, cb) { 39 | hotMiddleware.publish({ action: 'reload' }) 40 | cb() 41 | }) 42 | }) 43 | 44 | // proxy api requests 45 | Object.keys(proxyTable).forEach(function (context) { 46 | var options = proxyTable[context] 47 | if (typeof options === 'string') { 48 | options = { target: options } 49 | } 50 | app.use(proxyMiddleware(options.filter || context, options)) 51 | }) 52 | 53 | // handle fallback for HTML5 history API 54 | app.use(require('connect-history-api-fallback')()) 55 | 56 | // serve webpack bundle output 57 | app.use(devMiddleware) 58 | 59 | // enable hot-reload and state-preserving 60 | // compilation error display 61 | app.use(hotMiddleware) 62 | 63 | // serve pure static assets 64 | var staticPath = path.posix.join(config.dev.assetsPublicPath, config.dev.assetsSubDirectory) 65 | app.use(staticPath, express.static('./static')) 66 | 67 | var uri = 'http://localhost:' + port 68 | 69 | var _resolve 70 | var readyPromise = new Promise(resolve => { 71 | _resolve = resolve 72 | }) 73 | 74 | console.log('> Starting dev server...') 75 | devMiddleware.waitUntilValid(() => { 76 | console.log('> Listening at ' + uri + '\n') 77 | // when env is testing, don't need open it 78 | if (autoOpenBrowser && process.env.NODE_ENV !== 'testing') { 79 | opn(uri) 80 | } 81 | _resolve() 82 | }) 83 | 84 | var server = app.listen(port) 85 | 86 | module.exports = { 87 | ready: readyPromise, 88 | close: () => { 89 | server.close() 90 | } 91 | } 92 | }); 93 | -------------------------------------------------------------------------------- /build/prerequisites.js: -------------------------------------------------------------------------------- 1 | const fs = require('fs'); 2 | const path = require('path'); 3 | const readline = require('readline'); 4 | 5 | const wyvernConfig = path.join(__dirname, 'wyvernConfig.json'); 6 | 7 | module.exports = function(callback) { 8 | if (fs.existsSync(wyvernConfig)) { 9 | const file = JSON.parse(fs.readFileSync(wyvernConfig, 'utf8')); 10 | if (!file.base_url || !file.root) { 11 | const rl = readline.createInterface({ 12 | input: process.stdin, 13 | output: process.stdout, 14 | }); 15 | console.log('\x1b[31m\x1b[1mYou don\'t have your development URL in config file!\x1b[0m'); 16 | console.log('/build/wyvernConfig.json\n'); 17 | rl.question('Please fill your development URL: (i.e. example.dev) ', function(answer) { 18 | let baseUrl = answer; 19 | if (answer.indexOf('http://') === -1) { 20 | baseUrl = `http://${answer}`; 21 | } 22 | file.base_url = baseUrl; 23 | rl.question( 24 | `Please fill root URL of Wordpress REST API: (${baseUrl}/wp-json) `, 25 | function (secondAnswer) { 26 | let root = secondAnswer; 27 | if (!secondAnswer) { 28 | root = `${baseUrl}/wp-json`; 29 | } 30 | file.root = root; 31 | rl.close(); 32 | } 33 | ); 34 | }); 35 | rl.on('close', function() { 36 | fs.writeFileSync(wyvernConfig, JSON.stringify(file, null, 4)); 37 | callback(); 38 | }); 39 | } else { 40 | callback(); 41 | } 42 | } 43 | }; 44 | -------------------------------------------------------------------------------- /build/utils.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var config = require('../config') 3 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 4 | 5 | exports.assetsPath = function (_path) { 6 | var assetsSubDirectory = process.env.NODE_ENV === 'production' 7 | ? config.build.assetsSubDirectory 8 | : config.dev.assetsSubDirectory 9 | return path.posix.join(assetsSubDirectory, _path) 10 | } 11 | 12 | exports.cssLoaders = function (options) { 13 | options = options || {} 14 | 15 | var cssLoader = { 16 | loader: 'css-loader', 17 | options: { 18 | minimize: process.env.NODE_ENV === 'production', 19 | sourceMap: options.sourceMap 20 | } 21 | } 22 | 23 | // generate loader string to be used with extract text plugin 24 | function generateLoaders (loader, loaderOptions) { 25 | var loaders = [cssLoader] 26 | if (loader) { 27 | loaders.push({ 28 | loader: loader + '-loader', 29 | options: Object.assign({}, loaderOptions, { 30 | sourceMap: options.sourceMap 31 | }) 32 | }) 33 | } 34 | 35 | // Extract CSS when that option is specified 36 | // (which is the case during production build) 37 | if (options.extract) { 38 | return ExtractTextPlugin.extract({ 39 | use: loaders, 40 | fallback: 'vue-style-loader' 41 | }) 42 | } else { 43 | return ['vue-style-loader'].concat(loaders) 44 | } 45 | } 46 | 47 | // https://vue-loader.vuejs.org/en/configurations/extract-css.html 48 | return { 49 | css: generateLoaders(), 50 | postcss: generateLoaders(), 51 | less: generateLoaders('less'), 52 | sass: generateLoaders('sass', { indentedSyntax: true }), 53 | scss: generateLoaders('sass'), 54 | stylus: generateLoaders('stylus'), 55 | styl: generateLoaders('stylus') 56 | } 57 | } 58 | 59 | // Generate loaders for standalone style files (outside of .vue) 60 | exports.styleLoaders = function (options) { 61 | var output = [] 62 | var loaders = exports.cssLoaders(options) 63 | for (var extension in loaders) { 64 | var loader = loaders[extension] 65 | output.push({ 66 | test: new RegExp('\\.' + extension + '$'), 67 | use: loader 68 | }) 69 | } 70 | return output 71 | } 72 | -------------------------------------------------------------------------------- /build/vue-loader.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var config = require('../config') 3 | var isProduction = process.env.NODE_ENV === 'production' 4 | 5 | module.exports = { 6 | loaders: utils.cssLoaders({ 7 | sourceMap: isProduction 8 | ? config.build.productionSourceMap 9 | : config.dev.cssSourceMap, 10 | extract: isProduction 11 | }) 12 | } 13 | -------------------------------------------------------------------------------- /build/webpack.base.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var config = require('../config') 4 | var vueLoaderConfig = require('./vue-loader.conf') 5 | 6 | function resolve (dir) { 7 | return path.join(__dirname, '..', dir) 8 | } 9 | 10 | module.exports = { 11 | entry: { 12 | app: ['babel-polyfill', './src/main.js'] 13 | }, 14 | output: { 15 | path: config.build.assetsRoot, 16 | filename: '[name].js', 17 | publicPath: process.env.NODE_ENV === 'production' 18 | ? config.build.assetsPublicPath 19 | : config.dev.assetsPublicPath 20 | }, 21 | resolve: { 22 | extensions: ['.js', '.vue', '.json'], 23 | alias: { 24 | 'vue$': 'vue/dist/vue.esm.js', 25 | '@': resolve('src') 26 | } 27 | }, 28 | module: { 29 | rules: [ 30 | { 31 | test: /\.(js|vue)$/, 32 | loader: 'eslint-loader', 33 | enforce: 'pre', 34 | include: [resolve('src'), resolve('test')], 35 | options: { 36 | formatter: require('eslint-friendly-formatter') 37 | } 38 | }, 39 | { 40 | test: /\.vue$/, 41 | loader: 'vue-loader', 42 | options: vueLoaderConfig 43 | }, 44 | { 45 | test: /\.js$/, 46 | loader: 'babel-loader', 47 | include: [resolve('src'), resolve('test')] 48 | }, 49 | { 50 | test: /\.(png|jpe?g|gif|svg)(\?.*)?$/, 51 | loader: 'url-loader', 52 | options: { 53 | limit: 10000, 54 | name: utils.assetsPath('img/[name].[hash:7].[ext]') 55 | } 56 | }, 57 | { 58 | test: /\.(woff2?|eot|ttf|otf)(\?.*)?$/, 59 | loader: 'url-loader', 60 | options: { 61 | limit: 10000, 62 | name: utils.assetsPath('fonts/[name].[hash:7].[ext]') 63 | } 64 | } 65 | ] 66 | } 67 | } 68 | -------------------------------------------------------------------------------- /build/webpack.dev.conf.js: -------------------------------------------------------------------------------- 1 | var utils = require('./utils') 2 | var webpack = require('webpack') 3 | var config = require('../config') 4 | var merge = require('webpack-merge') 5 | var baseWebpackConfig = require('./webpack.base.conf') 6 | var HtmlWebpackPlugin = require('html-webpack-plugin') 7 | var FriendlyErrorsPlugin = require('friendly-errors-webpack-plugin') 8 | 9 | module.exports = config; 10 | 11 | // add hot-reload related code to entry chunks 12 | Object.keys(baseWebpackConfig.entry).forEach(function (name) { 13 | baseWebpackConfig.entry[name] = ['./build/dev-client'].concat(baseWebpackConfig.entry[name]) 14 | }) 15 | 16 | module.exports = merge(baseWebpackConfig, { 17 | module: { 18 | rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) 19 | }, 20 | // cheap-module-eval-source-map is faster for development 21 | devtool: '#cheap-module-eval-source-map', 22 | plugins: [ 23 | new webpack.DefinePlugin({ 24 | 'process.env': config.dev.env 25 | }), 26 | // https://github.com/glenjamin/webpack-hot-middleware#installation--usage 27 | new webpack.HotModuleReplacementPlugin(), 28 | new webpack.NoEmitOnErrorsPlugin(), 29 | // https://github.com/ampedandwired/html-webpack-plugin 30 | new HtmlWebpackPlugin({ 31 | filename: 'index.html', 32 | template: 'index.html', 33 | inject: true 34 | }), 35 | new FriendlyErrorsPlugin() 36 | ] 37 | }) 38 | -------------------------------------------------------------------------------- /build/webpack.prod.conf.js: -------------------------------------------------------------------------------- 1 | var path = require('path') 2 | var utils = require('./utils') 3 | var webpack = require('webpack') 4 | var config = require('../config') 5 | var merge = require('webpack-merge') 6 | var baseWebpackConfig = require('./webpack.base.conf') 7 | var CopyWebpackPlugin = require('copy-webpack-plugin') 8 | var HtmlWebpackPlugin = require('html-webpack-plugin') 9 | var ExtractTextPlugin = require('extract-text-webpack-plugin') 10 | var OptimizeCSSPlugin = require('optimize-css-assets-webpack-plugin') 11 | var ManifestPlugin = require('webpack-manifest-plugin') 12 | 13 | var env = process.env.NODE_ENV === 'testing' 14 | ? require('../config/test.env') 15 | : config.build.env 16 | 17 | var webpackConfig = merge(baseWebpackConfig, { 18 | module: { 19 | rules: utils.styleLoaders({ 20 | sourceMap: config.build.productionSourceMap, 21 | extract: true 22 | }) 23 | }, 24 | devtool: config.build.productionSourceMap ? config.build.devtool : false, 25 | output: { 26 | path: config.build.assetsRoot, 27 | filename: utils.assetsPath('js/[name].[chunkhash].js'), 28 | chunkFilename: utils.assetsPath('js/[id].[chunkhash].js') 29 | }, 30 | plugins: [ 31 | // http://vuejs.github.io/vue-loader/en/workflow/production.html 32 | new webpack.DefinePlugin({ 33 | 'process.env': env 34 | }), 35 | new webpack.optimize.UglifyJsPlugin({ 36 | compress: { 37 | warnings: false 38 | }, 39 | sourceMap: true 40 | }), 41 | // extract css into its own file 42 | new ExtractTextPlugin({ 43 | filename: utils.assetsPath('css/[name].[contenthash].css') 44 | }), 45 | // Compress extracted CSS. We are using this plugin so that possible 46 | // duplicated CSS from different components can be deduped. 47 | new OptimizeCSSPlugin({ 48 | cssProcessorOptions: { 49 | safe: true 50 | } 51 | }), 52 | // generate dist index.html with correct asset hash for caching. 53 | // you can customize output by editing /index.html 54 | // see https://github.com/ampedandwired/html-webpack-plugin 55 | new HtmlWebpackPlugin({ 56 | filename: process.env.NODE_ENV === 'testing' 57 | ? 'index.html' 58 | : config.build.index, 59 | template: 'index.html', 60 | inject: true, 61 | minify: { 62 | removeComments: true, 63 | collapseWhitespace: true, 64 | removeAttributeQuotes: true 65 | // more options: 66 | // https://github.com/kangax/html-minifier#options-quick-reference 67 | }, 68 | // necessary to consistently work with multiple chunks via CommonsChunkPlugin 69 | chunksSortMode: 'dependency' 70 | }), 71 | // split vendor js into its own file 72 | new webpack.optimize.CommonsChunkPlugin({ 73 | name: 'vendor', 74 | minChunks: function (module, count) { 75 | // any required modules inside node_modules are extracted to vendor 76 | return ( 77 | module.resource && 78 | /\.js$/.test(module.resource) && 79 | module.resource.indexOf( 80 | path.join(__dirname, '../node_modules') 81 | ) === 0 82 | ) 83 | } 84 | }), 85 | // extract webpack runtime and module manifest to its own file in order to 86 | // prevent vendor hash from being updated whenever app bundle is updated 87 | new webpack.optimize.CommonsChunkPlugin({ 88 | name: 'manifest', 89 | chunks: ['vendor'] 90 | }), 91 | // copy custom static assets 92 | new CopyWebpackPlugin([ 93 | { 94 | from: path.resolve(__dirname, '../static'), 95 | to: config.build.assetsSubDirectory, 96 | ignore: ['.*'] 97 | } 98 | ]), 99 | new ManifestPlugin() 100 | ] 101 | }) 102 | 103 | if (config.build.productionGzip) { 104 | var CompressionWebpackPlugin = require('compression-webpack-plugin') 105 | 106 | webpackConfig.plugins.push( 107 | new CompressionWebpackPlugin({ 108 | asset: '[path].gz[query]', 109 | algorithm: 'gzip', 110 | test: new RegExp( 111 | '\\.(' + 112 | config.build.productionGzipExtensions.join('|') + 113 | ')$' 114 | ), 115 | threshold: 10240, 116 | minRatio: 0.8 117 | }) 118 | ) 119 | } 120 | 121 | if (config.build.bundleAnalyzerReport) { 122 | var BundleAnalyzerPlugin = require('webpack-bundle-analyzer').BundleAnalyzerPlugin 123 | webpackConfig.plugins.push(new BundleAnalyzerPlugin()) 124 | } 125 | 126 | module.exports = webpackConfig 127 | -------------------------------------------------------------------------------- /build/webpack.test.conf.js: -------------------------------------------------------------------------------- 1 | // This is the webpack config used for unit tests. 2 | 3 | var utils = require('./utils') 4 | var webpack = require('webpack') 5 | var merge = require('webpack-merge') 6 | var baseConfig = require('./webpack.base.conf') 7 | 8 | var webpackConfig = merge(baseConfig, { 9 | // use inline sourcemap for karma-sourcemap-loader 10 | module: { 11 | rules: utils.styleLoaders() 12 | }, 13 | devtool: '#inline-source-map', 14 | resolveLoader: { 15 | alias: { 16 | // necessary to to make lang="scss" work in test when using vue-loader's ?inject option 17 | // see discussion at https://github.com/vuejs/vue-loader/issues/724 18 | 'scss-loader': 'sass-loader' 19 | } 20 | }, 21 | plugins: [ 22 | new webpack.DefinePlugin({ 23 | 'process.env': require('../config/test.env') 24 | }) 25 | ] 26 | }) 27 | 28 | // no need for app entry during tests 29 | delete webpackConfig.entry 30 | 31 | module.exports = webpackConfig 32 | -------------------------------------------------------------------------------- /build/wyvern.js: -------------------------------------------------------------------------------- 1 | if (typeof window.config === 'undefined') { 2 | var json = require('./wyvernConfig.json'); 3 | window.config = { 4 | base_url: json.base_url, 5 | root: json.root 6 | } 7 | } -------------------------------------------------------------------------------- /build/wyvernConfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "base_url": "http://wordpress.test", 3 | "root": "http://wordpress.test/wp-json" 4 | } 5 | -------------------------------------------------------------------------------- /config/dev.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var prodEnv = require('./prod.env') 3 | 4 | module.exports = merge(prodEnv, { 5 | NODE_ENV: '"development"' 6 | }) 7 | -------------------------------------------------------------------------------- /config/index.js: -------------------------------------------------------------------------------- 1 | // see http://vuejs-templates.github.io/webpack for documentation. 2 | var path = require('path') 3 | 4 | module.exports = { 5 | build: { 6 | env: require('./prod.env'), 7 | index: path.resolve(__dirname, '../dist/index.html'), 8 | assetsRoot: path.resolve(__dirname, '../dist'), 9 | assetsSubDirectory: '', 10 | assetsPublicPath: './', 11 | productionSourceMap: true, 12 | devtool: '#source-map', 13 | // Gzip off by default as many popular static hosts such as 14 | // Surge or Netlify already gzip all static assets for you. 15 | // Before setting to `true`, make sure to: 16 | // npm install --save-dev compression-webpack-plugin 17 | productionGzip: false, 18 | productionGzipExtensions: ['js', 'css'], 19 | // Run the build command with an extra argument to 20 | // View the bundle analyzer report after build finishes: 21 | // `npm run build --report` 22 | // Set to `true` or `false` to always turn it on or off 23 | bundleAnalyzerReport: process.env.npm_config_report 24 | }, 25 | dev: { 26 | env: require('./dev.env'), 27 | port: 8080, 28 | autoOpenBrowser: true, 29 | assetsSubDirectory: 'static', 30 | assetsPublicPath: '/', 31 | proxyTable: {}, 32 | // CSS Sourcemaps off by default because relative paths are "buggy" 33 | // with this option, according to the CSS-Loader README 34 | // (https://github.com/webpack/css-loader#sourcemaps) 35 | // In our experience, they generally work as expected, 36 | // just be aware of this issue when enabling this option. 37 | cssSourceMap: false 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /config/prod.env.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | NODE_ENV: '"production"' 3 | } 4 | -------------------------------------------------------------------------------- /config/test.env.js: -------------------------------------------------------------------------------- 1 | var merge = require('webpack-merge') 2 | var devEnv = require('./dev.env') 3 | 4 | module.exports = merge(devEnv, { 5 | NODE_ENV: '"testing"' 6 | }) 7 | -------------------------------------------------------------------------------- /extensions/.gitkeep: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bitterendio/wyvern/0c5e96a51401dac68ea730f12348a7028314c217/extensions/.gitkeep -------------------------------------------------------------------------------- /extensions/options/README.md: -------------------------------------------------------------------------------- 1 | # Options 2 | 3 | Wyvern theme Options extension 4 | 5 | ## Installation 6 | 7 | Copy to your wyvern theme extensions folder, usually: 8 | 9 | ``` 10 | /wp-content/themes/wyvern/extensions/ 11 | ``` 12 | 13 | ## Usage 14 | 15 | If Wyvern theme is activated, you will find new admin page within your wp-admin under 16 | 17 | **Appearance > Wyvern Theme** -------------------------------------------------------------------------------- /extensions/options/api.php: -------------------------------------------------------------------------------- 1 | - Get option value by it's slug 12 | | /options/update_option/