Procházet zdrojové kódy

:recycle: reformatting according to prettier rules

tags/0.9.0
j před 4 roky
rodič
revize
59f51a9fb8

+ 8
- 8
vue-theme/postcss.config.js Zobrazit soubor

@@ -1,9 +1,9 @@
1 1
 module.exports = {
2
-  parser: "sugarss",
3
-  plugins: [
4
-    require("postcss-import"),
5
-    require("precss"),
6
-    require("postcss-calc"),
7
-    require("autoprefixer"),
8
-  ],
9
-};
2
+    parser: 'sugarss',
3
+    plugins: [
4
+        require('postcss-import'),
5
+        require('precss'),
6
+        require('postcss-calc'),
7
+        require('autoprefixer'),
8
+    ],
9
+}

+ 1
- 3
vue-theme/src/index.js Zobrazit soubor

@@ -6,6 +6,4 @@ import App from '@/app.vue'
6 6
 
7 7
 const craft = createApp(App)
8 8
 
9
-craft.use(router)
10
-    .use(store)
11
-    .mount('#wp-app')
9
+craft.use(router).use(store).mount('#wp-app')

+ 6
- 6
vue-theme/src/pages/mixin-post-types.js Zobrazit soubor

@@ -7,7 +7,7 @@ import { mapGetters, mapState } from 'vuex'
7 7
  * See modules folder
8 8
  */
9 9
 const getterHelper = {}
10
-for(let type of postTypes) {
10
+for (let type of postTypes) {
11 11
     const capitalized = convertTitleCase(type)
12 12
     getterHelper[`all${capitalized}BySlug`] = `all${capitalized}BySlug`
13 13
     getterHelper[`all${capitalized}`] = `all${capitalized}`
@@ -15,20 +15,20 @@ for(let type of postTypes) {
15 15
 }
16 16
 
17 17
 const stateHelper = {}
18
-for(let type of postTypes) {
18
+for (let type of postTypes) {
19 19
     stateHelper[type] = type
20 20
 }
21 21
 
22 22
 const postTypeGetters = {
23 23
     computed: {
24 24
         ...mapGetters(getterHelper),
25
-        ...mapState(stateHelper)
26
-    }
25
+        ...mapState(stateHelper),
26
+    },
27 27
 }
28 28
 const scrollTop = {
29 29
     mounted() {
30 30
         window.scrollTo(0, 0)
31
-    }
31
+    },
32 32
 }
33 33
 
34
-export { postTypeGetters, scrollTop }
34
+export { postTypeGetters, scrollTop }

+ 1
- 1
vue-theme/src/pages/single.vue Zobrazit soubor

@@ -53,7 +53,7 @@ import credits from '@/components/credits'
53 53
 import { postTypeGetters, scrollTop } from './mixin-post-types'
54 54
 
55 55
 import { convertTitleCase, dePluralize, typeFromRoute } from '@/utils/helpers'
56
-
56
+ 
57 57
 export default {
58 58
     components: { sidebar, gallery, block, credits },
59 59
     props: {

+ 5
- 4
vue-theme/src/router/index.js Zobrazit soubor

@@ -5,20 +5,21 @@ import { convertTitleCase } from '@/utils/helpers'
5 5
 
6 6
 const router = createRouter({
7 7
     history: createWebHistory(),
8
-    routes
8
+    routes,
9 9
 })
10 10
 
11 11
 router.beforeEach((to, from, next) => {
12 12
     document.title = 'Craft in America'
13 13
     // Append list type
14
-    if(to.path.split('/').length > 1 && to.path.split('/')[1]) {
14
+    if (to.path.split('/').length > 1 && to.path.split('/')[1]) {
15 15
         const path = convertTitleCase(to.path.split('/')[1])
16 16
         document.title = `${document.title} - ${path}`
17 17
     }
18 18
     // Append slugs and sort titles
19
-    if(to.path.split('/')[2]) document.title = `${document.title} - ${to.path.split('/')[2]}`
19
+    if (to.path.split('/')[2])
20
+        document.title = `${document.title} - ${to.path.split('/')[2]}`
20 21
 
21 22
     next()
22 23
 })
23 24
 
24
-export default router
25
+export default router

+ 35
- 15
vue-theme/src/router/routes.js Zobrazit soubor

@@ -8,33 +8,53 @@ export default [
8 8
     // Home Page
9 9
     { path: '/', component: indexPage },
10 10
     // List Pages
11
-    { 
11
+    {
12 12
         path: '/episodes',
13 13
         component: listPage,
14
-        props: { sidebar: false, grid: true }
14
+        props: { sidebar: false, grid: true },
15 15
     },
16
-    { 
16
+    {
17 17
         path: '/artists',
18 18
         component: listPage,
19
-        props: { sidebar: true, grid: true }
19
+        props: { sidebar: true, grid: true },
20 20
     },
21 21
     { path: '/:type', component: listPage, props: { sidebar: true } },
22
-    // Sorted List Pages 
23
-    { 
22
+    // Sorted List Pages
23
+    {
24 24
         path: `/artists/${sortTypes.alpha}`,
25 25
         component: listPage,
26
-        props: { sidebar: true, grid: true, sortBy: `${sortTypes.alpha}` }
26
+        props: { sidebar: true, grid: true, sortBy: `${sortTypes.alpha}` },
27 27
     },
28
-    { 
28
+    {
29 29
         path: `/artists/${sortTypes.recent}`,
30 30
         component: listPage,
31
-        props: { sidebar: true, grid: true, sortBy: `${sortTypes.material}` }
31
+        props: { sidebar: true, grid: true, sortBy: `${sortTypes.material}` },
32
+    },
33
+    {
34
+        path: `/:type/${sortTypes.alpha}`,
35
+        component: listPage,
36
+        props: { sidebar: true, sortBy: `${sortTypes.alpha}` },
37
+    },
38
+    {
39
+        path: `/:type/${sortTypes.recent}`,
40
+        component: listPage,
41
+        props: { sidebar: true, sortBy: `${sortTypes.recent}` },
42
+    },
43
+    {
44
+        path: `/:type/${sortTypes.material}`,
45
+        component: listPage,
46
+        props: { sidebar: true, sortBy: `${sortTypes.material}` },
47
+    },
48
+    {
49
+        path: '/:type/by-episode',
50
+        component: listPage,
51
+        props: { sidebar: true, sortBy: 'by-episode' },
52
+    },
53
+    {
54
+        path: '/:type/by-artist',
55
+        component: listPage,
56
+        props: { sidebar: true, sortBy: 'by-artist' },
32 57
     },
33
-    { path: `/:type/${sortTypes.alpha}`, component: listPage, props: { sidebar: true, sortBy: `${sortTypes.alpha}` } },
34
-    { path: `/:type/${sortTypes.recent}`, component: listPage, props: { sidebar: true, sortBy: `${sortTypes.recent}` } },
35
-    { path: `/:type/${sortTypes.material}`, component: listPage, props: { sidebar: true, sortBy: `${sortTypes.material}` } },
36
-    { path: '/:type/by-episode', component: listPage, props: { sidebar: true, sortBy: 'by-episode' } },
37
-    { path: '/:type/by-artist', component: listPage, props: { sidebar: true, sortBy: 'by-artist' } },
38 58
     // Single Pages
39 59
     { path: '/:type/:slug', component: singlePage, props: { sidebar: true } },
40
-]
60
+]

+ 1
- 1
vue-theme/src/store/actions.js Zobrazit soubor

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

+ 1
- 2
vue-theme/src/store/getters.js Zobrazit soubor

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

+ 37
- 37
vue-theme/src/store/index.js Zobrazit soubor

@@ -18,48 +18,48 @@ const debug = process.env.NODE_ENV !== 'production'
18 18
 
19 19
 // Current page state
20 20
 const state = {
21
-  title: wp.site_name,
22
-  hero: {
23
-    url: 'http://sample-image-url/',
24
-    text: 'sample hero text',
25
-    playbutton: true
26
-  },
27
-  currentGallery: null,
28
-  view: 'list'
21
+    title: wp.site_name,
22
+    hero: {
23
+        url: 'http://sample-image-url/',
24
+        text: 'sample hero text',
25
+        playbutton: true,
26
+    },
27
+    currentGallery: null,
28
+    view: 'list',
29 29
 }
30 30
 
31 31
 const mutations = {
32
-  SET_HERO(state, hero) {
33
-    if(!hero) return
34
-    
35
-    if (hero.url) {
36
-      state.hero.text = state.hero.url = hero.url
37
-    } else {
38
-      state.hero.text = hero
39
-    }
40
-  },
41
-  SET_GALLERY(state, idList) {
42
-    state.gallery = idList
43
-  },
44
-  CLEAR_GALLERY(state) {
45
-    state.gallery = null
46
-  }
32
+    SET_HERO(state, hero) {
33
+        if (!hero) return
34
+
35
+        if (hero.url) {
36
+            state.hero.text = state.hero.url = hero.url
37
+        } else {
38
+            state.hero.text = hero
39
+        }
40
+    },
41
+    SET_GALLERY(state, idList) {
42
+        state.gallery = idList
43
+    },
44
+    CLEAR_GALLERY(state) {
45
+        state.gallery = null
46
+    },
47 47
 }
48 48
 
49 49
 const store = new Vuex.Store({
50
-  actions,
51
-  getters,
52
-  mutations,
53
-  state,
54
-  modules: {
55
-      posts,
56
-      pages,
57
-      artists,
58
-      episodes,
59
-      events,
60
-      exhibitions
61
-  },
62
-  strict: debug,
50
+    actions,
51
+    getters,
52
+    mutations,
53
+    state,
54
+    modules: {
55
+        posts,
56
+        pages,
57
+        artists,
58
+        episodes,
59
+        events,
60
+        exhibitions,
61
+    },
62
+    strict: debug,
63 63
 })
64 64
 
65
-export default store
65
+export default store

+ 24
- 13
vue-theme/src/store/modules/artist.js Zobrazit soubor

@@ -8,11 +8,12 @@ const state = {
8 8
 
9 9
 const getters = {
10 10
     allArtists: state => state.all,
11
-    allArtistsBySlug: state => Object.values(state.all).reduce((bySlug, artist) => {
12
-        bySlug[artist.slug] = artist
13
-        return bySlug
14
-    }, {}),
15
-    allArtistsLoaded: state => state.loaded
11
+    allArtistsBySlug: state =>
12
+        Object.values(state.all).reduce((bySlug, artist) => {
13
+            bySlug[artist.slug] = artist
14
+            return bySlug
15
+        }, {}),
16
+    allArtistsLoaded: state => state.loaded,
16 17
 }
17 18
 
18 19
 const actions = {
@@ -28,19 +29,29 @@ const actions = {
28 29
         console.log('getting single Artist...')
29 30
         commit('CLEAR_SINGLE_ARTIST')
30 31
         commit('ARTISTS_LOADED', false)
31
-        api.getSingleType('artists', id,  artist => {
32
+        api.getSingleType('artists', id, artist => {
32 33
             commit('STORE_FETCHED_SINGLE_ARTIST', artist)
33 34
             commit('ARTISTS_LOADED', true)
34 35
         })
35
-    }
36
+    },
36 37
 }
37 38
 
38 39
 const mutations = {
39
-    STORE_FETCHED_ARTISTS(state, { artists }) { state.all = artists },
40
-    STORE_FETCHED_SINGLE_ARTIST(state, artist) { state.singleArtist = artist },
41
-    CLEAR_ARTISTS(state) { state.all = [] },
42
-    CLEAR_SINGLE_ARTIST(state) { state.singleArtist = null },
43
-    ARTISTS_LOADED(state, val) { state.loaded = val },
40
+    STORE_FETCHED_ARTISTS(state, { artists }) {
41
+        state.all = artists
42
+    },
43
+    STORE_FETCHED_SINGLE_ARTIST(state, artist) {
44
+        state.singleArtist = artist
45
+    },
46
+    CLEAR_ARTISTS(state) {
47
+        state.all = []
48
+    },
49
+    CLEAR_SINGLE_ARTIST(state) {
50
+        state.singleArtist = null
51
+    },
52
+    ARTISTS_LOADED(state, val) {
53
+        state.loaded = val
54
+    },
44 55
 }
45 56
 
46
-export default { state, getters, actions, mutations }
57
+export default { state, getters, actions, mutations }

+ 23
- 12
vue-theme/src/store/modules/episode.js Zobrazit soubor

@@ -8,10 +8,11 @@ const state = {
8 8
 
9 9
 const getters = {
10 10
     allEpisodes: state => state.all,
11
-    allEpisodesBySlug: state => Object.values(state.all).reduce((bySlug, episode) => {
12
-        bySlug[episode.slug] = episode
13
-        return bySlug
14
-    }, {}),
11
+    allEpisodesBySlug: state =>
12
+        Object.values(state.all).reduce((bySlug, episode) => {
13
+            bySlug[episode.slug] = episode
14
+            return bySlug
15
+        }, {}),
15 16
     allEpisodesLoaded: state => state.loaded,
16 17
 }
17 18
 
@@ -27,19 +28,29 @@ const actions = {
27 28
     getSingleEpisode({ commit }, id) {
28 29
         commit('CLEAR_SINGLE_EPISODE')
29 30
         commit('EPISODES_LOADED', false)
30
-        api.getSingleType('episodes', id,  episode => {
31
+        api.getSingleType('episodes', id, episode => {
31 32
             commit('STORE_FETCHED_SINGLE_EPISODE', episode)
32 33
             commit('EPISODES_LOADED', true)
33 34
         })
34
-    }
35
+    },
35 36
 }
36 37
 
37 38
 const mutations = {
38
-    STORE_FETCHED_EPISODES(state, { episodes }) { state.all = episodes },
39
-    STORE_FETCHED_SINGLE_EPISODE(state, episode) { state.singleEpisode = episode },
40
-    CLEAR_EPISODES(state) { state.all = [] },
41
-    CLEAR_SINGLE_EPISODE(state) { state.episode = null },
42
-    EPISODES_LOADED(state, val) { state.loaded = val },
39
+    STORE_FETCHED_EPISODES(state, { episodes }) {
40
+        state.all = episodes
41
+    },
42
+    STORE_FETCHED_SINGLE_EPISODE(state, episode) {
43
+        state.singleEpisode = episode
44
+    },
45
+    CLEAR_EPISODES(state) {
46
+        state.all = []
47
+    },
48
+    CLEAR_SINGLE_EPISODE(state) {
49
+        state.episode = null
50
+    },
51
+    EPISODES_LOADED(state, val) {
52
+        state.loaded = val
53
+    },
43 54
 }
44 55
 
45
-export default { state, getters, actions, mutations }
56
+export default { state, getters, actions, mutations }

+ 19
- 9
vue-theme/src/store/modules/event.js Zobrazit soubor

@@ -8,7 +8,7 @@ const state = {
8 8
 
9 9
 const getters = {
10 10
     allEvents: state => state.all,
11
-    allEventsLoaded: state => state.loaded
11
+    allEventsLoaded: state => state.loaded,
12 12
 }
13 13
 
14 14
 const actions = {
@@ -23,19 +23,29 @@ const actions = {
23 23
     getSingleEvent({ commit }, id) {
24 24
         commit('CLEAR_SINGLE_EVENT')
25 25
         commit('EVENTS_LOADED', false)
26
-        api.getSingleType('events', id,  event => {
26
+        api.getSingleType('events', id, event => {
27 27
             commit('STORE_FETCHED_SINGLE_EVENT', event)
28 28
             commit('EVENTS_LOADED', true)
29 29
         })
30
-    }
30
+    },
31 31
 }
32 32
 
33 33
 const mutations = {
34
-    STORE_FETCHED_EVENTS(state, { events }) { state.all = events },
35
-    STORE_FETCHED_SINGLE_EVENT(state, event) { state.singleEvent = event },
36
-    CLEAR_EVENTS(state) { state.all = [] },
37
-    CLEAR_SINGLE_EVENT(state) { state.singleEvent = null },
38
-    EVENTS_LOADED(state, val) { state.loaded = val },
34
+    STORE_FETCHED_EVENTS(state, { events }) {
35
+        state.all = events
36
+    },
37
+    STORE_FETCHED_SINGLE_EVENT(state, event) {
38
+        state.singleEvent = event
39
+    },
40
+    CLEAR_EVENTS(state) {
41
+        state.all = []
42
+    },
43
+    CLEAR_SINGLE_EVENT(state) {
44
+        state.singleEvent = null
45
+    },
46
+    EVENTS_LOADED(state, val) {
47
+        state.loaded = val
48
+    },
39 49
 }
40 50
 
41
-export default { state, getters, actions, mutations }
51
+export default { state, getters, actions, mutations }

+ 19
- 9
vue-theme/src/store/modules/exhibition.js Zobrazit soubor

@@ -8,7 +8,7 @@ const state = {
8 8
 
9 9
 const getters = {
10 10
     allExhibitions: state => state.all,
11
-    allExhibitionsLoaded: state => state.loaded
11
+    allExhibitionsLoaded: state => state.loaded,
12 12
 }
13 13
 
14 14
 const actions = {
@@ -23,19 +23,29 @@ const actions = {
23 23
     getSingleExhibition({ commit }, id) {
24 24
         commit('CLEAR_SINGLE_EXHIBITION')
25 25
         commit('EXHIBITIONS_LOADED', false)
26
-        api.getSingleType('exhibitions', id,  exhibition => {
26
+        api.getSingleType('exhibitions', id, exhibition => {
27 27
             commit('STORE_FETCHED_SINGLE_EXHIBITION', exhibition)
28 28
             commit('EXHIBITIONS_LOADED', true)
29 29
         })
30
-    }
30
+    },
31 31
 }
32 32
 
33 33
 const mutations = {
34
-    STORE_FETCHED_EXHIBITIONS(state, { exhibitions }) { state.all = exhibitions },
35
-    STORE_FETCHED_SINGLE_EXHIBITION(state, exhibition) { state.singleExhibition = exhibition },
36
-    CLEAR_EXHIBITIONS(state) { state.all = [] },
37
-    CLEAR_SINGLE_EXHIBITION(state) { state.singleExhibition = null },
38
-    EXHIBITIONS_LOADED(state, val) { state.loaded = val },
34
+    STORE_FETCHED_EXHIBITIONS(state, { exhibitions }) {
35
+        state.all = exhibitions
36
+    },
37
+    STORE_FETCHED_SINGLE_EXHIBITION(state, exhibition) {
38
+        state.singleExhibition = exhibition
39
+    },
40
+    CLEAR_EXHIBITIONS(state) {
41
+        state.all = []
42
+    },
43
+    CLEAR_SINGLE_EXHIBITION(state) {
44
+        state.singleExhibition = null
45
+    },
46
+    EXHIBITIONS_LOADED(state, val) {
47
+        state.loaded = val
48
+    },
39 49
 }
40 50
 
41
-export default { state, getters, actions, mutations }
51
+export default { state, getters, actions, mutations }

+ 19
- 9
vue-theme/src/store/modules/page.js Zobrazit soubor

@@ -10,7 +10,7 @@ const state = {
10 10
 // getters
11 11
 const getters = {
12 12
     allPages: state => state.all,
13
-    allPagesLoaded: state => state.loaded
13
+    allPagesLoaded: state => state.loaded,
14 14
 }
15 15
 
16 16
 // actions
@@ -25,20 +25,30 @@ const actions = {
25 25
     getSinglePage({ commit }, id) {
26 26
         commit('CLEAR_SINGLE_PAGE')
27 27
         commit('PAGES_LOADED', false)
28
-        api.getSingleType('pages', id,  page => {
28
+        api.getSingleType('pages', id, page => {
29 29
             commit('STORE_FETCHED_SINGLE_PAGE', page)
30 30
             commit('PAGES_LOADED', true)
31 31
         })
32
-    }
32
+    },
33 33
 }
34 34
 
35 35
 // mutations
36 36
 const mutations = {
37
-    STORE_FETCHED_PAGES(state, { pages }) { state.all = pages },
38
-    STORE_FETCHED_SINGLE_PAGE(state, page) { state.singlePage = page },
39
-    CLEAR_PAGES(state) { state.all = [] },
40
-    CLEAR_SINGLE_PAGE(state) { state.singlePage = null },
41
-    PAGES_LOADED(state, val) { state.loaded = val },
37
+    STORE_FETCHED_PAGES(state, { pages }) {
38
+        state.all = pages
39
+    },
40
+    STORE_FETCHED_SINGLE_PAGE(state, page) {
41
+        state.singlePage = page
42
+    },
43
+    CLEAR_PAGES(state) {
44
+        state.all = []
45
+    },
46
+    CLEAR_SINGLE_PAGE(state) {
47
+        state.singlePage = null
48
+    },
49
+    PAGES_LOADED(state, val) {
50
+        state.loaded = val
51
+    },
42 52
 }
43 53
 
44
-export default { state, getters, actions, mutations }
54
+export default { state, getters, actions, mutations }

+ 18
- 8
vue-theme/src/store/modules/post.js Zobrazit soubor

@@ -23,19 +23,29 @@ const actions = {
23 23
     getSinglePost({ commit }, id) {
24 24
         commit('CLEAR_SINGLE_POST')
25 25
         commit('POSTS_LOADED', false)
26
-        api.getSingleType('posts', id,  post => {
26
+        api.getSingleType('posts', id, post => {
27 27
             commit('STORE_FETCHED_SINGLE_POST', post)
28 28
             commit('POSTS_LOADED', true)
29 29
         })
30
-    }
30
+    },
31 31
 }
32 32
 
33 33
 const mutations = {
34
-    STORE_FETCHED_POSTS(state, { posts }) { state.all = posts },
35
-    STORE_FETCHED_SINGLE_POST(state, post) { state.singlePost = post },
36
-    CLEAR_POSTS(state) { state.all = [] },
37
-    CLEAR_SINGLE_POST(state) { state.singlePost = null },
38
-    POSTS_LOADED(state, val) { state.loaded = val },
34
+    STORE_FETCHED_POSTS(state, { posts }) {
35
+        state.all = posts
36
+    },
37
+    STORE_FETCHED_SINGLE_POST(state, post) {
38
+        state.singlePost = post
39
+    },
40
+    CLEAR_POSTS(state) {
41
+        state.all = []
42
+    },
43
+    CLEAR_SINGLE_POST(state) {
44
+        state.singlePost = null
45
+    },
46
+    POSTS_LOADED(state, val) {
47
+        state.loaded = val
48
+    },
39 49
 }
40 50
 
41
-export default { state, getters, actions, mutations }
51
+export default { state, getters, actions, mutations }

+ 43
- 25
vue-theme/src/utils/api.js Zobrazit soubor

@@ -9,38 +9,56 @@ const SETTINGS = {
9 9
 export default {
10 10
     getByType(type, sortType, cb) {
11 11
         if (sortType) {
12
-            return axios.get(SETTINGS.API_BASE_PATH + `sort/${type}/${sortType}`).then(response => {
13
-                cb(response.data)
14
-                return response.data
15
-            }).catch(e => { cb(e) })
16
-        }
17
-
18
-        else {
19
-            return axios.get(SETTINGS.API_BASE_PATH + `${type}`).then(response => {
20
-                cb(response.data)
21
-                return response.data
22
-            }).catch(e => { cb(e) })
12
+            return axios
13
+                .get(SETTINGS.API_BASE_PATH + `sort/${type}/${sortType}`)
14
+                .then(response => {
15
+                    cb(response.data)
16
+                    return response.data
17
+                })
18
+                .catch(e => {
19
+                    cb(e)
20
+                })
21
+        } else {
22
+            return axios
23
+                .get(SETTINGS.API_BASE_PATH + `${type}`)
24
+                .then(response => {
25
+                    cb(response.data)
26
+                    return response.data
27
+                })
28
+                .catch(e => {
29
+                    cb(e)
30
+                })
23 31
         }
24 32
     },
25 33
     async getSingleType(type, id, cb) {
26
-        await axios.get(SETTINGS.API_BASE_PATH + `${type}/${id}`).then(response => {
27
-            cb(Object.values(response.data)[0])
28
-        }).catch(e => { cb(e) })
34
+        await axios
35
+            .get(SETTINGS.API_BASE_PATH + `${type}/${id}`)
36
+            .then(response => {
37
+                cb(Object.values(response.data)[0])
38
+            })
39
+            .catch(e => {
40
+                cb(e)
41
+            })
29 42
     },
30 43
     async getSingleMedia(id, cb) {
31
-        await axios.get(SETTINGS.API_MEDIA_PATH + `${id}`).then(response => {
32
-            cb(response.data)
33
-        }).catch(e => { cb(e) })
44
+        await axios
45
+            .get(SETTINGS.API_MEDIA_PATH + `${id}`)
46
+            .then(response => {
47
+                cb(response.data)
48
+            })
49
+            .catch(e => {
50
+                cb(e)
51
+            })
34 52
     },
35 53
 
36 54
     getPosts(limit = 5, cb) {
37 55
         axios
38
-        .get(SETTINGS.API_BASE_PATH + 'posts')
39
-        .then(response => {
40
-            cb(response.data)
41
-        })
42
-        .catch(e => {
43
-            cb(e)
44
-        })
56
+            .get(SETTINGS.API_BASE_PATH + 'posts')
57
+            .then(response => {
58
+                cb(response.data)
59
+            })
60
+            .catch(e => {
61
+                cb(e)
62
+            })
45 63
     },
46
-}
64
+}

+ 24
- 27
vue-theme/webpack.config.js Zobrazit soubor

@@ -6,27 +6,28 @@ const CompressionPlugin = require('compression-webpack-plugin')
6 6
 const PostCssPlugins = [
7 7
     require('postcss-import'),
8 8
     require('precss'),
9
-    require('autoprefixer')
9
+    require('autoprefixer'),
10 10
 ]
11 11
 
12 12
 module.exports = (env = {}) => {
13 13
     return {
14 14
         mode: env.production ? 'production' : 'development',
15 15
         resolve: {
16
-        alias: {
16
+            alias: {
17 17
                 '@': path.resolve(__dirname, 'src'),
18 18
             },
19
-            extensions: ['*', '.js', '.sss', '.vue', '.json']
19
+            extensions: ['*', '.js', '.sss', '.vue', '.json'],
20 20
         },
21 21
         module: {
22
-            rules: [{
22
+            rules: [
23
+                {
23 24
                     test: /\.vue$/,
24
-                    use: ['vue-loader']
25
+                    use: ['vue-loader'],
25 26
                 },
26 27
                 {
27 28
                     test: /\.(js)$/,
28 29
                     loader: 'babel-loader',
29
-                    exclude: /node_modules/
30
+                    exclude: /node_modules/,
30 31
                 },
31 32
                 {
32 33
                     test: /\.pug$/,
@@ -34,42 +35,38 @@ module.exports = (env = {}) => {
34 35
                         // this applies to `<template lang="pug">` in Vue components
35 36
                         {
36 37
                             resourceQuery: /^\?vue/,
37
-                            use: ['pug-plain-loader']
38
-                        }
39
-                    ]
38
+                            use: ['pug-plain-loader'],
39
+                        },
40
+                    ],
40 41
                 },
41 42
                 {
42 43
                     test: /\.(png|jpg|gif|svg|ttf|woff2|woff)$/,
43 44
                     loader: 'url-loader',
44 45
                     options: {
45 46
                         limit: 10000,
46
-                        name: '[name].[ext]?[hash]'
47
-                    }
47
+                        name: '[name].[ext]?[hash]',
48
+                    },
48 49
                 },
49 50
                 {
50 51
                     test: /(\.html$|favicon)/,
51 52
                     loader: 'file-loader',
52 53
                     options: {
53
-                        name: '[name].[ext]'
54
-                    }
54
+                        name: '[name].[ext]',
55
+                    },
55 56
                 },
56 57
                 {
57 58
                     test: /\.(css|sss|postcss)$/,
58
-                    use: [
59
-                        'style-loader',
60
-                        'css-loader',
61
-                        'postcss-loader',
62
-                    ]
63
-                }
64
-            ]
59
+                    use: ['style-loader', 'css-loader', 'postcss-loader'],
60
+                },
61
+            ],
65 62
         },
66 63
         output: {
67 64
             path: path.join(__dirname, 'build'),
68
-            publicPath: '/build/'
65
+            publicPath: '/build/',
69 66
         },
70 67
         // https://github.com/Tech-Nomad/wue-theme
71 68
         devServer: {
72
-            publicPath: "/build/",
69
+            publicPath: '/build/',
73 70
             https: false,
74 71
             inline: true,
75 72
             noInfo: false,
@@ -81,7 +78,7 @@ module.exports = (env = {}) => {
81 78
             writeToDisk: true,
82 79
             proxy: {
83 80
                 '/': {
84
-                    target: "http://localhost:8080",
81
+                    target: 'http://localhost:8080',
85 82
                     secure: false,
86 83
                     changeOrigin: true,
87 84
                     autoRewrite: true,
@@ -94,11 +91,11 @@ module.exports = (env = {}) => {
94 91
         devtool: env.production ? false : 'cheap-module-eval-source-map',
95 92
         plugins: [
96 93
             new webpack.DefinePlugin({
97
-                PRODUCTION: JSON.stringify(env.production)
94
+                PRODUCTION: JSON.stringify(env.production),
98 95
             }),
99 96
             new VueLoaderPlugin(),
100 97
             new CompressionPlugin({ threshold: 8192 }),
101
-            new webpack.HotModuleReplacementPlugin()
102
-        ]
98
+            new webpack.HotModuleReplacementPlugin(),
99
+        ],
103 100
     }
104
-}
101
+}

Načítá se…
Zrušit
Uložit