Bläddra i källkod

:art: getting postcss imports working nicely

tags/0.0.1
J 5 år sedan
förälder
incheckning
01fc35a80b
6 ändrade filer med 38 tillägg och 46 borttagningar
  1. 0
    3
      package.json
  2. 7
    2
      src/App.vue
  3. 13
    13
      src/components/card.vue
  4. 0
    21
      src/sss/index.js
  5. 6
    6
      src/sss/theme.sss
  6. 12
    1
      src/sss/variables.sss

+ 0
- 3
package.json Visa fil

@@ -25,8 +25,5 @@
25 25
     "pug-plain-loader": "^1.1.0",
26 26
     "sugarss": "^3.0.3",
27 27
     "vite": "^2.2.3"
28
-  },
29
-  "resolutions": {
30
-    "postcss": "8.2.13"
31 28
   }
32 29
 }

+ 7
- 2
src/App.vue Visa fil

@@ -13,7 +13,7 @@ import card from '@/components/card.vue'
13 13
 export default {
14 14
     components: { card, helloWorld },
15 15
     setup() {
16
-    
16
+        
17 17
         const cards = ref([
18 18
             { name: 'jwick' },
19 19
             { name: 'hwick' },
@@ -35,6 +35,11 @@ export default {
35 35
 </script>
36 36
 
37 37
 <style lang="postcss">
38
+@import './sss/partials/_reset.sss'
39
+@import './sss/partials/_ratios.sss'
40
+@import './sss/partials/_helpers.sss'
41
+@import './sss/partials/_typography.sss'
42
+
38 43
 @import './sss/theme.sss'
39 44
 @import './sss/variables.sss'
40 45
 
@@ -44,6 +49,6 @@ export default {
44 49
     text-align: center
45 50
     color: $primary
46 51
     font-family: $sans
47
-    margin-top: $ms-2
52
+    padding: $ms-0
48 53
     background-color: $secondary
49 54
 </style>

+ 13
- 13
src/components/card.vue Visa fil

@@ -1,5 +1,5 @@
1 1
 <template lang="pug">
2
-.card
2
+.card.f-col
3 3
     header
4 4
         p {{ card.name }}
5 5
 
@@ -36,25 +36,25 @@ const close = e => {
36 36
 </script>
37 37
 
38 38
 <style lang="postcss">
39
-
40
-$pad: 0.5vw
39
+@import '@/sss/theme.sss'
40
+@import '@/sss/variables.sss'
41 41
 
42 42
 .card
43
-    background-color: rebeccapurple
43
+    background-color: $primary
44 44
     opacity: 0.8
45
-    width: calc($pad * 20)
46
-    height: calc($pad * 40)
47
-    border-radius: $pad
48
-    margin-bottom: -5vh
49
-    display: flex
45
+    width: $ms-4
46
+    height: $ms-5
47
+    border-radius: $ms-0
48
+    margin: 0 $ms-0 0 0
50 49
     border: 1px solid black
51
-    flex-direction: column
50
+    transition: $transition
52 51
     header, main, footer
52
+        color: $dark
53 53
         text-align: left
54
-        padding: 0 $pad
54
+        padding: 0 $ms-1
55 55
     header
56
-        padding-top: $pad
56
+        padding-top: $ms-1
57 57
     footer
58
-        padding-bottom: $pad
58
+        padding-bottom: $ms-1
59 59
 
60 60
 </style>

+ 0
- 21
src/sss/index.js Visa fil

@@ -1,21 +0,0 @@
1
-import '@/sss/partials/_helpers.sss'
2
-import '@/sss/partials/_typography.sss'
3
-import '@/sss/partials/_reset.sss'
4
-
5
-import layoutVars from '@/sss/variables.sss'
6
-import themeVars from '@/sss/theme.sss'
7
-
8
-const splitVars = varsFromSSS => {
9
-    return varsFromSSS.split('\n').map(line => line.split(':')).reduce((vars, pair) => {
10
-        if(pair[0][0] !== '$') return vars
11
-        const varname = pair[0].replace('$', '')
12
-        vars[varname] = pair[1].replace(' ', '')
13
-        vars[varname] = vars[varname].replace(/[\n\r]/g, '')
14
-        return vars
15
-    }, {})
16
-}
17
-
18
-const size = splitVars(layoutVars)
19
-const theme = splitVars(themeVars)
20
-
21
-export { size, theme }

+ 6
- 6
src/sss/theme.sss Visa fil

@@ -4,13 +4,13 @@
4 4
   * Colors
5 5
 */
6 6
 $hue: 200
7
-$bg: calc($hue * $ms-1)
7
+$bg: calc($hue * $cs-1)
8 8
 $bright: 50%
9 9
 $opacity: 1
10 10
 
11
-$primary: hsla($hue, 20%, calc($bright * $ms-1), $opacity)
12
-$secondary: hsla($bg, 20%, calc($bright * $ms-1), $opacity)
13
-$hilite: hsla($hue, 50%, calc($bright * $ms-0), $opacity)
11
+$primary: hsla($hue, 20%, calc($bright * $cs-1), $opacity)
12
+$secondary: hsla($bg, 20%, calc($bright * $cs-1), $opacity)
13
+$hilite: hsla($hue, 50%, calc($bright * $cs-0), $opacity)
14 14
 
15
-$light: hsla(255, 50%, calc($bright * $ms-0), $opacity)
16
-$dark: hsla(001, 50%, calc($bright * $ms-0), $opacity)
15
+$light: hsla(255, 50%, calc($bright * $cs-0), $opacity)
16
+$dark: hsla(001, 50%, calc($bright * $cs-0), $opacity)

+ 12
- 1
src/sss/variables.sss Visa fil

@@ -34,4 +34,15 @@ $ms-5: calc($ms-4 * $scale)
34 34
 $ms-6: calc($ms-5 * $scale)
35 35
 $ms-7: calc($ms-6 * $scale)
36 36
 $ms-8: calc($ms-7 * $scale)
37
-$ms-9: calc($ms-8 * $scale)
37
+$ms-9: calc($ms-8 * $scale)
38
+
39
+/**
40
+  * Color Scale
41
+  */
42
+$cbase: 1
43
+$cs-0: calc($cbase)
44
+$cs-1: calc($cs-0 * $scale)
45
+$cs-2: calc($cs-1 * $scale)
46
+$cs-3: calc($cs-2 * $scale)
47
+$cs-4: calc($cs-3 * $scale)
48
+$cs-5: calc($cs-4 * $scale)

Laddar…
Avbryt
Spara