Ver código fonte

got working sss files and style shortcuts started

tags/0.9.0
J 6 anos atrás
pai
commit
393a6222f3

+ 29
- 0
vue-theme/functions.php Ver arquivo

77
     wp_enqueue_script( 'vue-theme' );
77
     wp_enqueue_script( 'vue-theme' );
78
 }
78
 }
79
 add_action( 'wp_enqueue_scripts', 'vue_theme_scripts' );
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 Ver arquivo

1
 <template lang="pug">
1
 <template lang="pug">
2
-div#theme
2
+div#theme.f-col
3
     cia-nav
3
     cia-nav
4
     main
4
     main
5
         router-view
5
         router-view
7
 </template>
7
 </template>
8
 
8
 
9
 <script>
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
 export default {
15
 export default {
16
     components: {
16
     components: {
21
 </script>
21
 </script>
22
 
22
 
23
 <style lang="postcss">
23
 <style lang="postcss">
24
+@import './sss/_variables.sss'
25
+@import './sss/_flex.sss'
26
+
24
 html > body
27
 html > body
25
     font-family: sans-serif
28
     font-family: sans-serif
26
     main > article[class^="page--"]
29
     main > article[class^="page--"]
27
-        padding: 0.5em
30
+        padding: var(--spacer)
28
         > section
31
         > section
29
-            padding: 0 0 0.5em
32
+            padding: 0 0 var(--spacer)
30
     :--headings
33
     :--headings
31
         color: red
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
 </style>
45
 </style>

+ 0
- 10
vue-theme/src/components/footer.vue Ver arquivo

2
 footer.main
2
 footer.main
3
     h2 footer
3
     h2 footer
4
 </template>
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 Ver arquivo

3
 
3
 
4
 Vue.use(VueRouter)
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
 const router = new VueRouter({
12
 const router = new VueRouter({
13
     mode: 'history',
13
     mode: 'history',

+ 21
- 0
vue-theme/src/sss/_flex.sss Ver arquivo

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 Ver arquivo

1
 // Custom selectors
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 Ver arquivo

2
 *
2
 *
3
     margin: 0
3
     margin: 0
4
     padding: 0
4
     padding: 0
5
-    box-sizing: border-box
5
+    box-sizing: inherit
6
     &:before, &:after
6
     &:before, &:after
7
         background-repeat: no-repeat
7
         background-repeat: no-repeat
8
         box-sizing: inherit
8
         box-sizing: inherit
18
     font-family: system-ui
18
     font-family: system-ui
19
     line-height: 1.15
19
     line-height: 1.15
20
     tab-size: 4
20
     tab-size: 4
21
-
21
+    box-sizing: border-box
22
+    
22
 // Always set color/background/font-size on root
23
 // Always set color/background/font-size on root
23
 body
24
 body
24
     margin: 0
25
     margin: 0
31
     ol, ul
32
     ol, ul
32
         list-style: none
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
 // Reset some other default styles
35
 // Reset some other default styles
39
 button, input, select, textarea
36
 button, input, select, textarea
40
     font-family: inherit
37
     font-family: inherit

+ 8
- 14
vue-theme/src/widgets/navigation/navigation.vue Ver arquivo

1
 <template lang="pug">
1
 <template lang="pug">
2
 nav.main
2
 nav.main
3
-    ul
3
+    ul.f-row.between
4
         li
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
         li
11
         li
7
             a(href="/lazy") lazy
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 Ver arquivo

12
 module.exports = (env = {}) => {
12
 module.exports = (env = {}) => {
13
     return {
13
     return {
14
         mode: env.production ? 'production' : 'development',
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
         module: {
22
         module: {
16
             rules: [{
23
             rules: [{
17
                     test: /\.vue$/,
24
                     test: /\.vue$/,
69
             path: path.join(__dirname, 'build'),
76
             path: path.join(__dirname, 'build'),
70
             publicPath: '/build/'
77
             publicPath: '/build/'
71
         },
78
         },
79
+        // https://github.com/Tech-Nomad/wue-theme
72
         devServer: {
80
         devServer: {
81
+            publicPath: "/build/",
73
             https: false,
82
             https: false,
74
             inline: true,
83
             inline: true,
75
             noInfo: false,
84
             noInfo: false,

Carregando…
Cancelar
Salvar