Przeglądaj źródła

got working sss files and style shortcuts started

tags/0.9.0
J 6 lat temu
rodzic
commit
393a6222f3

+ 29
- 0
vue-theme/functions.php Wyświetl plik

@@ -77,3 +77,32 @@ function vue_theme_scripts() {
77 77
     wp_enqueue_script( 'vue-theme' );
78 78
 }
79 79
 add_action( 'wp_enqueue_scripts', 'vue_theme_scripts' );
80
+
81
+/**
82
+ * disable endpoints in rest api
83
+ **/
84
+add_filter( 'rest_endpoints', function ( $endpoints ) {
85
+	if ( isset( $endpoints['/wp/v2/users'] ) ) {
86
+		unset( $endpoints['/wp/v2/users'] );
87
+	}
88
+	if ( isset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] ) ) {
89
+		unset( $endpoints['/wp/v2/users/(?P<id>[\d]+)'] );
90
+	}
91
+
92
+    if ( isset( $endpoints['/wp/v2/comments'] ) ) {
93
+		unset( $endpoints['/wp/v2/comments'] );
94
+	}
95
+	if ( isset( $endpoints['/wp/v2/comments/(?P<id>[\d]+)'] ) ) {
96
+		unset( $endpoints['/wp/v2/comments/(?P<id>[\d]+)'] );
97
+    }
98
+    
99
+    if ( isset( $endpoints['/wp/v2/settings'] ) ) {
100
+		unset( $endpoints['/wp/v2/settings'] );
101
+	}
102
+	return $endpoints;
103
+} );
104
+
105
+/**
106
+ * remove wordpress version number from files
107
+ **/
108
+remove_action( 'wp_head', 'wp_generator' );

+ 18
- 6
vue-theme/src/app.vue Wyświetl plik

@@ -1,5 +1,5 @@
1 1
 <template lang="pug">
2
-div#theme
2
+div#theme.f-col
3 3
     cia-nav
4 4
     main
5 5
         router-view
@@ -7,10 +7,10 @@ div#theme
7 7
 </template>
8 8
 
9 9
 <script>
10
-import navigation from './widgets/navigation/navigation.vue'
11
-import footer from './components/footer.vue'
10
+import navigation from '@/widgets/navigation/navigation'
11
+import footer from '@/components/footer'
12 12
 
13
-import './sss'
13
+import '@/sss'
14 14
 
15 15
 export default {
16 16
     components: {
@@ -21,13 +21,25 @@ export default {
21 21
 </script>
22 22
 
23 23
 <style lang="postcss">
24
+@import './sss/_variables.sss'
25
+@import './sss/_flex.sss'
26
+
24 27
 html > body
25 28
     font-family: sans-serif
26 29
     main > article[class^="page--"]
27
-        padding: 0.5em
30
+        padding: var(--spacer)
28 31
         > section
29
-            padding: 0 0 0.5em
32
+            padding: 0 0 var(--spacer)
30 33
     :--headings
31 34
         color: red
32 35
 
36
+    nav.main, footer.main
37
+        background-color: #ccc
38
+        margin: 0 0 var(--spacer)
39
+        padding: var(--spacer)
40
+        width: 100%
41
+        ul > li
42
+            padding: 0 var(--spacer)
43
+    footer.main
44
+        margin: var(--spacer) 0 0
33 45
 </style>

+ 0
- 10
vue-theme/src/components/footer.vue Wyświetl plik

@@ -2,13 +2,3 @@
2 2
 footer.main
3 3
     h2 footer
4 4
 </template>
5
-
6
-<style lang="postcss">
7
-footer.main
8
-    background-color: #ccc
9
-    margin: 0.5em 0 0
10
-    padding: 0.5em
11
-    width: 100vw
12
-    ul
13
-        list-style: none
14
-</style>

+ 3
- 3
vue-theme/src/index.js Wyświetl plik

@@ -3,11 +3,11 @@ import VueRouter from 'vue-router'
3 3
 
4 4
 Vue.use(VueRouter)
5 5
 
6
-import App from './app.vue'
6
+import App from '@/app.vue'
7 7
 
8
-import store from './store'
8
+import store from '@/store'
9 9
 
10
-import IndexPage from './pages/index.vue'
10
+import IndexPage from '@/pages/index.vue'
11 11
 
12 12
 const router = new VueRouter({
13 13
     mode: 'history',

+ 21
- 0
vue-theme/src/sss/_flex.sss Wyświetl plik

@@ -0,0 +1,21 @@
1
+[class^="f-"]
2
+    display: flex
3
+    justify-content: center
4
+    align-items: center
5
+
6
+.f
7
+    &-row
8
+        flex-direction: row
9
+    &-col
10
+        flex-direction: column
11
+    &-grow
12
+        flex-grow: 1
13
+    &-row, &-col
14
+        &.start
15
+            justify-content: flex-start
16
+        &.end
17
+            justify-content: flex-end
18
+        &.between
19
+            justify-content: space-between
20
+        &.around
21
+            justify-content: space-around

+ 6
- 1
vue-theme/src/sss/_variables.sss Wyświetl plik

@@ -1,2 +1,7 @@
1 1
 // Custom selectors
2
-@custom-selector :--headings h1, h2, h3, h4, h5, h6
2
+@custom-selector :--headings h1, h2, h3, h4, h5, h6
3
+
4
+@custom-media --viewport-medium (width <= 50rem)
5
+
6
+:root
7
+  --spacer: 0.5em

+ 3
- 6
vue-theme/src/sss/reset.sss Wyświetl plik

@@ -2,7 +2,7 @@
2 2
 *
3 3
     margin: 0
4 4
     padding: 0
5
-    box-sizing: border-box
5
+    box-sizing: inherit
6 6
     &:before, &:after
7 7
         background-repeat: no-repeat
8 8
         box-sizing: inherit
@@ -18,7 +18,8 @@ html
18 18
     font-family: system-ui
19 19
     line-height: 1.15
20 20
     tab-size: 4
21
-
21
+    box-sizing: border-box
22
+    
22 23
 // Always set color/background/font-size on root
23 24
 body
24 25
     margin: 0
@@ -31,10 +32,6 @@ nav
31 32
     ol, ul
32 33
         list-style: none
33 34
 
34
-// Useful for single page apps to use up all available space
35
-html, body
36
-    height: 100%
37
-
38 35
 // Reset some other default styles
39 36
 button, input, select, textarea
40 37
     font-family: inherit

+ 8
- 14
vue-theme/src/widgets/navigation/navigation.vue Wyświetl plik

@@ -1,19 +1,13 @@
1 1
 <template lang="pug">
2 2
 nav.main
3
-    ul
3
+    ul.f-row.between
4 4
         li
5
-            h3 navigation
5
+            a(href="/")
6
+                h3 navigation
7
+        li.f-grow
8
+            p &nbsp;
9
+        li
10
+            a(href="/") home
6 11
         li
7 12
             a(href="/lazy") lazy
8
-
9
-</template>
10
-
11
-<style lang="postcss">
12
-nav.main
13
-    background-color: #ccc
14
-    margin: 0 0 0.5em
15
-    padding: 0.5em
16
-    width: 100vw
17
-    ul
18
-        list-style: none
19
-</style>
13
+</template>

+ 9
- 0
vue-theme/webpack.config.js Wyświetl plik

@@ -12,6 +12,13 @@ const PostCssPlugins = [
12 12
 module.exports = (env = {}) => {
13 13
     return {
14 14
         mode: env.production ? 'production' : 'development',
15
+        resolve: {
16
+        alias: {
17
+                '@': path.resolve(__dirname, 'src'),
18
+                'vue$': 'vue/dist/vue.esm.js'
19
+            },
20
+            extensions: ['*', '.js', '.sss', '.vue', '.json']
21
+        },
15 22
         module: {
16 23
             rules: [{
17 24
                     test: /\.vue$/,
@@ -69,7 +76,9 @@ module.exports = (env = {}) => {
69 76
             path: path.join(__dirname, 'build'),
70 77
             publicPath: '/build/'
71 78
         },
79
+        // https://github.com/Tech-Nomad/wue-theme
72 80
         devServer: {
81
+            publicPath: "/build/",
73 82
             https: false,
74 83
             inline: true,
75 84
             noInfo: false,

Ładowanie…
Anuluj
Zapisz