Parcourir la source

base level outline | working API | working compose

tags/0.9.0
J il y a 6 ans
révision
2215fe0def

+ 31
- 0
.gitignore Voir le fichier

@@ -0,0 +1,31 @@
1
+# File system junk files
2
+Desktop.ini
3
+Thumbs.db
4
+.DS_Store
5
+._*
6
+.Spotlight-V100
7
+.Trashes
8
+.apdisk
9
+.fseventsd
10
+..bfg-report
11
+
12
+# Archives
13
+*.zip
14
+
15
+# Editor files
16
+*.sublime-*
17
+*.swp
18
+.c9
19
+
20
+# Wordpress
21
+uploads
22
+db
23
+**/node_modules
24
+plugins/cmb2
25
+plugins/duplicator
26
+plugins/hello.php
27
+plugins/akismet
28
+plugins/regenerate-thumbnails
29
+
30
+# Env
31
+.env

+ 100
- 0
configs/wp-config.php Voir le fichier

@@ -0,0 +1,100 @@
1
+<?php
2
+/**
3
+ * The base configuration for WordPress
4
+ *
5
+ * The wp-config.php creation script uses this file during the
6
+ * installation. You don't have to use the web site, you can
7
+ * copy this file to "wp-config.php" and fill in the values.
8
+ *
9
+ * This file contains the following configurations:
10
+ *
11
+ * * MySQL settings
12
+ * * Secret keys
13
+ * * Database table prefix
14
+ * * ABSPATH
15
+ *
16
+ * @link https://codex.wordpress.org/Editing_wp-config.php
17
+ *
18
+ * @package WordPress
19
+ */
20
+// Get custom environmental variables
21
+define('DB_PASSWORD', getenv('WORDPRESS_DB_PASSWORD'));
22
+define('DB_USER', getenv('WORDPRESS_DB_USER'));
23
+
24
+// ** MySQL settings - You can get this info from your web host ** //
25
+/** The name of the database for WordPress */
26
+define('DB_NAME', getenv('WORDPRESS_DB_NAME'));
27
+
28
+/** MySQL hostname */
29
+define('DB_HOST', 'mysql');
30
+
31
+/** Database Charset to use in creating database tables. */
32
+define('DB_CHARSET', 'utf8');
33
+
34
+/** The Database Collate type. Don't change this if in doubt. */
35
+define('DB_COLLATE', '');
36
+
37
+/**#@+
38
+ * Authentication Unique Keys and Salts.
39
+ *
40
+ * Change these to different unique phrases!
41
+ * You can generate these using the {@link https://api.wordpress.org/secret-key/1.1/salt/ WordPress.org secret-key service}
42
+ * You can change these at any point in time to invalidate all existing cookies. This will force all users to have to log in again.
43
+ *
44
+ * @since 2.6.0
45
+ */
46
+define('AUTH_KEY',         '5c79fa8455ac3a9d073b092f0d037bd59d76b46d');
47
+define('SECURE_AUTH_KEY',  '08bb369f951055190f734de6604e2e73d2ab4a5a');
48
+define('LOGGED_IN_KEY',    '7df12c7b77e5003dc495d065aba00d4ae92fcc6b');
49
+define('NONCE_KEY',        '55f0ec0d7a24dbe325ff9acbbf58fa5bb96aec3e');
50
+define('AUTH_SALT',        '5ff82df7f4a65524c25f17eaa7d1d0ed6b728824');
51
+define('SECURE_AUTH_SALT', '74696d119a6aa7b177f0e0123e5248b0c95621cf');
52
+define('LOGGED_IN_SALT',   '572abf75e1d94e2d715f5f7d3afb8fad96512cd8');
53
+define('NONCE_SALT',       '409a7ac7260e68234bfe5a19b4454e28aad34e73');
54
+
55
+/**#@-*/
56
+
57
+/**
58
+ * WordPress Database Table prefix.
59
+ *
60
+ * You can have multiple installations in one database if you give each
61
+ * a unique prefix. Only numbers, letters, and underscores please!
62
+ */
63
+$table_prefix  = 'wp_';
64
+
65
+/**
66
+ * For developers: WordPress debugging mode.
67
+ *
68
+ * Change this to true to enable the display of notices during development.
69
+ * It is strongly recommended that plugin and theme developers use WP_DEBUG
70
+ * in their development environments.
71
+ *
72
+ * For information on other constants that can be used for debugging,
73
+ * visit the Codex.
74
+ *
75
+ * @link https://codex.wordpress.org/Debugging_in_WordPress
76
+ */
77
+define('WP_DEBUG', false);
78
+
79
+// If we're behind a proxy server and using HTTPS, we need to alert Wordpress of that fact
80
+// see also http://codex.wordpress.org/Administration_Over_SSL#Using_a_Reverse_Proxy
81
+if (isset($_SERVER['HTTP_X_FORWARDED_PROTO']) && $_SERVER['HTTP_X_FORWARDED_PROTO'] === 'https') {
82
+        $_SERVER['HTTPS'] = 'on';
83
+}
84
+
85
+/* That's all, stop editing! Happy blogging. */
86
+
87
+/** Absolute path to the WordPress directory. */
88
+if ( !defined('ABSPATH') )
89
+        define('ABSPATH', dirname(__FILE__) . '/');
90
+
91
+/** Sets up WordPress vars and included files. */
92
+require_once(ABSPATH . 'wp-settings.php');
93
+
94
+/** DEV */
95
+define('IS_DEV', getenv('IS_DEV'));
96
+if(defined('IS_DEV') && IS_DEV ) {
97
+        $_SERVER['HTTPS'] = 'off';
98
+} else {
99
+        $_SERVER['HTTPS'] = 'on';
100
+}

+ 45
- 0
docker-compose.yml Voir le fichier

@@ -0,0 +1,45 @@
1
+version: '3' 
2
+
3
+services:
4
+    vue-wp:
5
+        depends_on:
6
+            - vue-db
7
+        image: wordpress
8
+        container_name: "vue-wp"
9
+        volumes:
10
+            - ./configs/wp-config.php:/usr/src/wordpress/wp-config-sample.php
11
+            - ./uploads:/var/www/html/wp-content/uploads
12
+            - ./plugins:/var/www/html/wp-content/plugins
13
+            - ./vue-theme:/var/www/html/wp-content/themes/vue-theme
14
+            - ./uploads.ini:/usr/local/etc/php/conf.d/uploads.ini
15
+        ports:
16
+            - "8080:80"
17
+        links:
18
+            - vue-db:mysql
19
+        environment:
20
+            WORDPRESS_DB_PASSWORD: "${DB_PASSWORD}"
21
+            IS_DEV: "${IS_DEV}"
22
+            WORDPRESS_DB_NAME: current_db
23
+
24
+    vue-db:
25
+        image: mariadb
26
+        container_name: "vue-db"
27
+        environment:
28
+            MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
29
+            INNODB_FLUSH_METHOD: O_DSYNC
30
+        volumes:
31
+            - db:/var/lib/mysql
32
+
33
+    vue-phpmyadmin:
34
+        image: phpmyadmin/phpmyadmin
35
+        container_name: "vue-phpmyadmin"
36
+        depends_on:
37
+            - vue-db
38
+        ports:
39
+            - 8181:80
40
+        environment:
41
+            PMA_HOST: vue-db
42
+            MYSQL_ROOT_PASSWORD: "${DB_PASSWORD}"
43
+
44
+volumes:
45
+    db:

+ 2
- 0
plugins/index.php Voir le fichier

@@ -0,0 +1,2 @@
1
+<?php
2
+// Silence is golden.

+ 5
- 0
uploads.ini Voir le fichier

@@ -0,0 +1,5 @@
1
+file_uploads = On 
2
+memory_limit = 512M
3
+upload_max_filesize = 20M
4
+post_max_size = 20M
5
+max_execution_time = 1200

+ 79
- 0
vue-theme/functions.php Voir le fichier

@@ -0,0 +1,79 @@
1
+<?php
2
+/**
3
+ * Theme Functions - functions.php
4
+ * 
5
+ * 1. Scripts needed to run the vue theme
6
+ */
7
+
8
+$path = $_SERVER['DOCUMENT_ROOT'];
9
+
10
+require_once $path . '/wp-load.php';
11
+require_once $path . '/wp-config.php';
12
+require_once $path . '/wp-includes/wp-db.php';
13
+require_once $path . '/wp-includes/pluggable.php';
14
+
15
+// https://github.com/EvanAgee/vuejs-wordpress-theme-starter/blob/master/functions.php
16
+remove_action( 'template_redirect', 'redirect_canonical' );
17
+function remove_redirects() {
18
+	add_rewrite_rule( '^/(.+)/?', 'index.php', 'top' );
19
+}
20
+add_action( 'init', 'remove_redirects' );
21
+
22
+
23
+function vue_theme_routes() {
24
+    $routes = array();
25
+
26
+    $query = new WP_Query( array(
27
+        'post_type'   => 'any',
28
+        'post_status' => 'publish',
29
+        'posts_per_page' => -1
30
+    ) );
31
+    if( $query->have_posts() ) {
32
+        while( $query->have_posts() ) {
33
+            $query->the_post();
34
+            $routes[] = array(
35
+                'id' => get_the_ID(),
36
+                'type' => get_post_type(),
37
+                'slug' => basename( get_permalink() ),
38
+            );
39
+        }
40
+    }
41
+    wp_reset_postdata();
42
+
43
+    return $routes;
44
+}
45
+
46
+/* 1 */
47
+function vue_theme_scripts() {
48
+
49
+	wp_enqueue_style( 'style', get_stylesheet_uri() );
50
+
51
+	if ( defined( 'IS_DEV' ) && IS_DEV ) {
52
+		wp_register_script(
53
+            'vue-theme',
54
+            'http://localhost:8081/main.js',
55
+            array( 'jquery' ),
56
+            false,
57
+            true 
58
+        );
59
+	} else {
60
+        wp_register_script(
61
+            'vue-theme',
62
+            get_template_directory_uri() . '/public/main.js',
63
+            array( 'jquery' ),
64
+            false,
65
+            true 
66
+        );
67
+	}
68
+
69
+	wp_localize_script( 'vue-theme', 'wp', array(
70
+        'template' => get_stylesheet_directory_uri(),
71
+        'rest' => esc_url_raw( rest_url() ),
72
+        'site_name' => get_bloginfo( 'name' ),
73
+        // 'nonce' => wp_create_nonce( 'wp_rest' ),
74
+        'routes' => vue_theme_routes(),
75
+    ) );
76
+
77
+    wp_enqueue_script( 'vue-theme' );
78
+}
79
+add_action( 'wp_enqueue_scripts', 'vue_theme_scripts' );

+ 43
- 0
vue-theme/index.php Voir le fichier

@@ -0,0 +1,43 @@
1
+<!DOCTYPE html>
2
+<html <?php language_attributes(); ?>>
3
+    <head>
4
+        <title><?php wp_title(); ?></title>
5
+        <meta charset="<?php bloginfo( 'charset' ); ?>">
6
+        <meta name="viewport" content="width=device-width, initial-scale=1">
7
+        <link rel="pingback" href="<?php bloginfo( 'pingback_url' ); ?>">
8
+        <?php wp_head(); ?>
9
+    </head>
10
+    <body>
11
+        <div id="content" class="site-content" style="display:none">
12
+
13
+        <?php
14
+
15
+        if ( have_posts() ) {
16
+
17
+            if ( is_home() && ! is_front_page() ) {
18
+                echo '<h1>' . single_post_title( '', false ) . '</h1>';
19
+            }
20
+
21
+            while ( have_posts() ) {
22
+
23
+                the_post();
24
+
25
+                if ( is_singular() ) {
26
+                    the_title( '<h1>', '</h1>' );
27
+                } else {
28
+                    the_title( '<h2><a href="' . esc_url( get_permalink() ) . '">', '</a></h2>' );
29
+                }
30
+
31
+                the_content();
32
+            }
33
+        }
34
+
35
+        ?>
36
+        
37
+        </div>
38
+        
39
+        <div id="wp-app"></div>
40
+
41
+        <?php wp_footer(); ?>
42
+    </body>
43
+</html>

+ 8916
- 0
vue-theme/package-lock.json
Fichier diff supprimé car celui-ci est trop grand
Voir le fichier


+ 60
- 0
vue-theme/package.json Voir le fichier

@@ -0,0 +1,60 @@
1
+{
2
+  "name": "vue-theme",
3
+  "version": "1.0.0",
4
+  "description": "Wordpress SPA theme base",
5
+  "main": "index.js",
6
+  "scripts": {
7
+    "dev": "webpack-dev-server --hot"
8
+  },
9
+  "keywords": [
10
+    "wordpress",
11
+    "vue"
12
+  ],
13
+  "author": "TOJ",
14
+  "license": "UNLICENSED",
15
+  "devDependencies": {
16
+    "@babel/core": "^7.9.0",
17
+    "@babel/preset-env": "^7.9.0",
18
+    "axios": "^0.19.2",
19
+    "babel-loader": "^8.1.0",
20
+    "css-loader": "^3.4.2",
21
+    "file-loader": "^6.0.0",
22
+    "postcss-calc": "^7.0.2",
23
+    "postcss-import": "^12.0.1",
24
+    "postcss-loader": "^3.0.0",
25
+    "precss": "^4.0.0",
26
+    "pug": "^2.0.4",
27
+    "pug-plain-loader": "^1.0.0",
28
+    "sugarss": "^2.0.0",
29
+    "url-loader": "^4.0.0",
30
+    "vue-hot-reload-api": "^2.3.4",
31
+    "vue-loader": "^15.9.1",
32
+    "vue-style-loader": "^4.1.2",
33
+    "vue-template-compiler": "^2.6.11",
34
+    "webpack": "^4.42.1",
35
+    "webpack-cli": "^3.3.11",
36
+    "webpack-dev-server": "^3.10.3"
37
+  },
38
+  "dependencies": {
39
+    "compression-webpack-plugin": "^3.1.0",
40
+    "vue": "^2.6.11",
41
+    "vue-router": "^3.1.6"
42
+  },
43
+  "babel": {
44
+    "presets": [
45
+      [
46
+        "@babel/preset-env",
47
+        {
48
+          "targets": {
49
+            "browsers": [
50
+              "last 2 Chrome versions",
51
+              "last 2 Firefox versions"
52
+            ]
53
+          }
54
+        }
55
+      ]
56
+    ],
57
+    "comments": false,
58
+    "plugins": []
59
+  }
60
+}

+ 16
- 0
vue-theme/src/app.vue Voir le fichier

@@ -0,0 +1,16 @@
1
+<template lang="pug">
2
+div(id="theme")
3
+    h1 hello new-theme
4
+    router-view
5
+</template>
6
+
7
+<script>
8
+export default {
9
+    data () {
10
+        return {}
11
+    }
12
+}
13
+</script>
14
+
15
+<style lang="postcss">
16
+</style>

+ 23
- 0
vue-theme/src/index.js Voir le fichier

@@ -0,0 +1,23 @@
1
+import Vue from 'vue'
2
+import VueRouter from 'vue-router'
3
+
4
+Vue.use(VueRouter)
5
+
6
+import App from './app.vue'
7
+import Index from './pages/index.vue'
8
+
9
+import store from './store'
10
+
11
+const routes = [
12
+    {
13
+        path: '/',
14
+        component: Index
15
+    }
16
+]
17
+
18
+const router = new VueRouter({
19
+    mode: 'history',
20
+    routes
21
+})
22
+
23
+new Vue({ store, router, render: h=>h(App) }).$mount('#wp-app')

+ 40
- 0
vue-theme/src/pages/index.vue Voir le fichier

@@ -0,0 +1,40 @@
1
+<template lang="pug">
2
+.page--index
3
+    p index page
4
+    p {{ site }}
5
+    div(v-if="allPagesLoaded")
6
+        h2 pages
7
+        p {{ somePages(10) }}
8
+    div(v-if="allPostsLoaded")
9
+        h2 posts
10
+        p {{ allPosts }}
11
+</template>
12
+
13
+<script>
14
+import { mapGetters } from 'vuex'
15
+
16
+export default {
17
+    computed: {
18
+        ...mapGetters({
19
+            somePages: 'somePages',
20
+            allPages: 'allPages',
21
+            allPostsLoaded: 'allPostsLoaded',
22
+            allPosts: 'allPosts',
23
+            allPagesLoaded: 'allPagesLoaded',
24
+        }),
25
+    },
26
+    data() {
27
+        return {
28
+            site: wp.site_name,
29
+        }
30
+    },
31
+    mounted() {
32
+        console.log('routes: ', wp.routes)
33
+        console.log('rest url: ', wp.rest)
34
+        console.log('template: ', wp.template)
35
+        
36
+        this.$store.dispatch('getAllPages')
37
+        this.$store.dispatch('getAllPosts')
38
+    }
39
+}
40
+</script>

+ 2
- 0
vue-theme/src/store/actions.js Voir le fichier

@@ -0,0 +1,2 @@
1
+// for global actions
2
+export default () => {}

+ 3
- 0
vue-theme/src/store/getters.js Voir le fichier

@@ -0,0 +1,3 @@
1
+
2
+// For global getters
3
+export default () => {}

+ 23
- 0
vue-theme/src/store/index.js Voir le fichier

@@ -0,0 +1,23 @@
1
+// SHAMELESS THEFT: https://github.com/EvanAgee/vuejs-wordpress-theme-starter
2
+import Vue from 'vue'
3
+import Vuex from 'vuex'
4
+
5
+import * as actions from './actions'
6
+import * as getters from './getters'
7
+
8
+import page from './modules/page'
9
+import post from './modules/post'
10
+
11
+Vue.use(Vuex)
12
+
13
+const debug = process.env.NODE_ENV !== 'production'
14
+
15
+export default new Vuex.Store({
16
+  actions,
17
+  getters,
18
+  modules: {
19
+      post,
20
+      page,
21
+  },
22
+  strict: debug,
23
+})

+ 50
- 0
vue-theme/src/store/modules/page.js Voir le fichier

@@ -0,0 +1,50 @@
1
+import api from '../../utils/api'
2
+
3
+// initial state
4
+const state = {
5
+    all: [],
6
+    loaded: false,
7
+    page: null,
8
+}
9
+
10
+// getters
11
+const getters = {
12
+    allPages: state => state.all,
13
+    allPagesLoaded: state => state.loaded,
14
+    page: state => id => {
15
+        let field = typeof id === 'number' ? 'id' : 'slug'
16
+        let page = state.all.filter(page => page[field] === id)
17
+        return (page[0]) ? page[0] : false
18
+    },
19
+    pageContent: state => id => {
20
+        let field = typeof id === 'number' ? 'id' : 'slug'
21
+        let page = state.all.filter(page => page[field] === id)
22
+        
23
+        return (page[0]) ? page[0].content.rendered : false
24
+    },
25
+    somePages: state => limit => {
26
+        if(state.all.length < 1) return false
27
+        
28
+        let all = [...state.all]
29
+        
30
+        return all.splice(0, Math.min(limit, state.all.length))
31
+    },
32
+}
33
+
34
+// actions
35
+const actions = {
36
+    getAllPages({ commit }) {
37
+        api.getByType('pages', pages => {
38
+            commit('STORE_FETCHED_PAGES', { pages })
39
+            commit('PAGES_LOADED', true)
40
+        })
41
+    }
42
+}
43
+
44
+// mutations
45
+const mutations = {
46
+    STORE_FETCHED_PAGES(state, { pages }) { state.all = pages },
47
+    PAGES_LOADED(state, val) { state.loaded = val },
48
+}
49
+
50
+export default { state, getters, actions, mutations }

+ 55
- 0
vue-theme/src/store/modules/post.js Voir le fichier

@@ -0,0 +1,55 @@
1
+import api from '../../utils/api'
2
+
3
+const createPostSlug = post => {
4
+    let slug = post.link.replace(window.location.protocol + '//' + window.location.host, '')
5
+    post.slug = slug
6
+    return post
7
+}
8
+
9
+const state = {
10
+    all: [],
11
+    loaded: false,
12
+    post: null,
13
+}
14
+
15
+const getters = {
16
+    allPosts: state => state.all,
17
+    allPostsLoaded: state => state.loaded,
18
+    post: state => id => {
19
+        let field = typeof id === 'number' ? 'id' : 'slug'
20
+        let post = state.all.filter(post => post[field] === id)
21
+        return (post[0]) ? post[0] : false
22
+    },
23
+    postContent: state => id => {
24
+        let field = typeof id === 'number' ? 'id' : 'slug'
25
+        let post = state.all.filter(post => post[field] === id)
26
+        
27
+        return (post[0]) ? post[0].content.rendered : false
28
+    },
29
+    somePosts: state => limit => {
30
+        if(state.all.length < 1) return false
31
+        
32
+        let all = [...state.all]
33
+        
34
+        return all.splice(0, Math.min(limit, state.all.length))
35
+    },
36
+}
37
+
38
+const actions = {
39
+    getAllPosts({ commit }) {
40
+        api.getByType('posts', posts => {
41
+            posts.map((post, i) => {
42
+                posts[i] = createPostSlug(post)
43
+            })
44
+            commit('STORE_FETCHED_POSTS', { posts })
45
+            commit('POSTS_LOADED', true)
46
+        })
47
+    }
48
+}
49
+
50
+const mutations = {
51
+    STORE_FETCHED_POSTS(state, { posts }) { state.all = posts },
52
+    POSTS_LOADED(state, val) { state.loaded = val },
53
+}
54
+
55
+export default { state, getters, actions, mutations }

+ 28
- 0
vue-theme/src/utils/api.js Voir le fichier

@@ -0,0 +1,28 @@
1
+import axios from 'axios'
2
+
3
+const SETTINGS = { 
4
+    LOADING_SEGMENTS: 2,
5
+    API_BASE_PATH: '/wp-json/wp/v2/'
6
+}
7
+
8
+export default {
9
+    getByType(type, cb) {
10
+        axios.get(SETTINGS.API_BASE_PATH + `${type}?per_page=10`)
11
+        .then(response => {
12
+            cb(response.data)
13
+        })
14
+        .catch(e => {
15
+            cb(e)
16
+        })
17
+    },
18
+    getPosts(limit = 5, cb) {
19
+        axios
20
+        .get(SETTINGS.API_BASE_PATH + 'posts?per_page=' + limit)
21
+        .then(response => {
22
+            cb(response.data)
23
+        })
24
+        .catch(e => {
25
+            cb(e)
26
+        })
27
+    },
28
+}

+ 4
- 0
vue-theme/src/utils/post-types.js Voir le fichier

@@ -0,0 +1,4 @@
1
+export default [
2
+    'posts',
3
+    'pages'
4
+]

+ 13
- 0
vue-theme/style.css Voir le fichier

@@ -0,0 +1,13 @@
1
+/*
2
+Theme Name: vue-theme
3
+Theme URI: http://herebefoci.com
4
+Author: TOJ
5
+Author URI: http: //herebefoci.com
6
+Description: A WordPress theme with Vue.js and REST API
7
+Version: 1.0.0
8
+License: MIT
9
+Contributors: Sagar Bhatt, Pradeep Sonawane
10
+*/
11
+html body {
12
+    color: purple;
13
+}

+ 84
- 0
vue-theme/webpack.config.js Voir le fichier

@@ -0,0 +1,84 @@
1
+const path = require('path')
2
+const webpack = require('webpack')
3
+const { VueLoaderPlugin } = require('vue-loader')
4
+const CompressionPlugin = require('compression-webpack-plugin')
5
+
6
+const PostCssPlugins = [
7
+    require('postcss-import'),
8
+    require('precss'),
9
+    require('autoprefixer')
10
+]
11
+
12
+module.exports = (env = {}) => {
13
+    return {
14
+        mode: env.production ? 'production' : 'development',
15
+        module: {
16
+            rules: [{
17
+                    test: /\.vue$/,
18
+                    use: ['vue-loader']
19
+                },
20
+                {
21
+                    test: /\.(js)$/,
22
+                    loader: 'babel-loader',
23
+                    exclude: /node_modules/
24
+                },
25
+                {
26
+                    test: /\.pug$/,
27
+                    oneOf: [
28
+                        // this applies to `<template lang="pug">` in Vue components
29
+                        {
30
+                            resourceQuery: /^\?vue/,
31
+                            use: ['pug-plain-loader']
32
+                        }
33
+                    ]
34
+                },
35
+                {
36
+                    test: /\.(png|jpg|gif|svg|ttf|woff2|woff)$/,
37
+                    loader: 'url-loader',
38
+                    options: {
39
+                        limit: 10000,
40
+                        name: '[name].[ext]?[hash]'
41
+                    }
42
+                },
43
+                {
44
+                    test: /(\.html$|favicon)/,
45
+                    loader: 'file-loader',
46
+                    options: {
47
+                        name: '[name].[ext]'
48
+                    }
49
+                },
50
+                {
51
+                    test: /\.(css|sss|postcss)$/,
52
+                    use: [{
53
+                            loader: 'vue-style-loader'
54
+                        },
55
+                        {
56
+                            loader: 'postcss-loader',
57
+                            options: {
58
+                                parser: 'sugarss',
59
+                                plugins: () => {
60
+                                    return PostCssPlugins
61
+                                }
62
+                            }
63
+                        }
64
+                    ]
65
+                }
66
+            ]
67
+        },
68
+        output: {
69
+            path: path.join(__dirname, 'public'),
70
+            publicPath: '/'
71
+        },
72
+        devServer: {
73
+            historyApiFallback: true
74
+        },
75
+        devtool: env.production ? false : 'cheap-module-eval-source-map',
76
+        plugins: [
77
+            new webpack.DefinePlugin({
78
+                PRODUCTION: JSON.stringify(env.production)
79
+            }),
80
+            new VueLoaderPlugin(),
81
+            new CompressionPlugin()
82
+        ]
83
+    }
84
+}

Chargement…
Annuler
Enregistrer