Browse Source

Add a runtime css build

master
Michael Weimann 1 month ago
parent
commit
4c59748487
No account linked to committer's email address
5 changed files with 67 additions and 36 deletions
  1. 39
    21
      build/xslt/fsfe_head.xsl
  2. 5
    0
      environment.xsl
  3. 5
    0
      environment.xsl.prod
  4. 0
    15
      look/fsfe.min.css
  5. 18
    0
      scripts/less.min.js

+ 39
- 21
build/xslt/fsfe_head.xsl View File

@@ -2,6 +2,8 @@
2 2
 
3 3
 <xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4 4
 
5
+  <xsl:import href="../../environment.xsl" />
6
+
5 7
   <xsl:variable name="mode">
6 8
     <!-- here you can set the mode to switch between normal and IloveFS style -->
7 9
     <xsl:value-of select="'normal'" /> <!-- can be either 'normal' or 'valentine' -->
@@ -30,13 +32,29 @@
30 32
       <xsl:attribute name="http-equiv">X-UA-Compatible</xsl:attribute>
31 33
       <xsl:attribute name="content">IE=edge</xsl:attribute>
32 34
     </xsl:element>
33
-    
34
-    <xsl:element name="link">
35
-      <xsl:attribute name="rel">stylesheet</xsl:attribute>
36
-      <xsl:attribute name="media">all</xsl:attribute>
37
-      <xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.min.css</xsl:attribute>
38
-      <xsl:attribute name="type">text/css</xsl:attribute>
39
-    </xsl:element>
35
+
36
+    <xsl:choose>
37
+      <xsl:when test="$environment = 'development'">
38
+        <xsl:element name="link">
39
+          <xsl:attribute name="rel">stylesheet/less</xsl:attribute>
40
+          <xsl:attribute name="media">all</xsl:attribute>
41
+          <xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.less</xsl:attribute>
42
+          <xsl:attribute name="type">text/css</xsl:attribute>
43
+        </xsl:element>
44
+        <xsl:element name="script">
45
+          <xsl:attribute name="src"><xsl:value-of select="$urlprefix"/>/scripts/less.min.js</xsl:attribute>
46
+        </xsl:element>
47
+      </xsl:when>
48
+      <xsl:otherwise>
49
+        <xsl:element name="link">
50
+          <xsl:attribute name="rel">stylesheet</xsl:attribute>
51
+          <xsl:attribute name="media">all</xsl:attribute>
52
+          <xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/fsfe.min.css</xsl:attribute>
53
+          <xsl:attribute name="type">text/css</xsl:attribute>
54
+        </xsl:element>
55
+      </xsl:otherwise>
56
+    </xsl:choose>
57
+
40 58
     <xsl:if test="$mode = 'valentine'">
41 59
       <xsl:element name="link">
42 60
         <xsl:attribute name="rel">stylesheet</xsl:attribute>
@@ -45,14 +63,14 @@
45 63
         <xsl:attribute name="type">text/css</xsl:attribute>
46 64
       </xsl:element>
47 65
     </xsl:if>
48
-    
66
+
49 67
     <xsl:element name="link">
50 68
       <xsl:attribute name="rel">stylesheet</xsl:attribute>
51 69
       <xsl:attribute name="media">print</xsl:attribute>
52 70
       <xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/look/print.css</xsl:attribute>
53 71
       <xsl:attribute name="type">text/css</xsl:attribute>
54 72
     </xsl:element>
55
-    
73
+
56 74
     <xsl:if test="/buildinfo/@language='ar'">
57 75
       <xsl:element name="link">
58 76
         <xsl:attribute name="rel">stylesheet</xsl:attribute>
@@ -61,7 +79,7 @@
61 79
         <xsl:attribute name="type">text/css</xsl:attribute>
62 80
       </xsl:element>
63 81
     </xsl:if>
64
-    
82
+
65 83
     <xsl:element name="link">
66 84
       <xsl:attribute name="rel">icon</xsl:attribute>
67 85
       <xsl:attribute name="href">
@@ -73,17 +91,17 @@
73 91
       </xsl:attribute>
74 92
       <xsl:attribute name="type">image/x-icon</xsl:attribute>
75 93
     </xsl:element>
76
-    
94
+
77 95
     <link rel="apple-touch-icon" href="{$urlprefix}/graphics/touch-icon.png" type="image/png" />
78 96
     <link rel="apple-touch-icon-precomposed" href="{$urlprefix}/graphics/touch-icon.png" type="image/png" />
79
-    
97
+
80 98
     <xsl:element name="link">
81 99
       <xsl:attribute name="rel">alternate</xsl:attribute>
82 100
       <xsl:attribute name="title">FSFE <xsl:call-template name="fsfe-gettext"><xsl:with-param name="id" select="'menu1/news'" /></xsl:call-template></xsl:attribute>
83 101
       <xsl:attribute name="href"><xsl:value-of select="$urlprefix"/>/news/news.<xsl:value-of select="/buildinfo/@language"/>.rss</xsl:attribute>
84 102
       <xsl:attribute name="type">application/rss+xml</xsl:attribute>
85 103
     </xsl:element>
86
-    
104
+
87 105
     <xsl:element name="link">
88 106
       <xsl:attribute name="rel">alternate</xsl:attribute>
89 107
       <xsl:attribute name="title">FSFE <xsl:call-template name="fsfe-gettext"><xsl:with-param name="id" select="'menu1/events'" /></xsl:call-template></xsl:attribute>
@@ -102,7 +120,7 @@
102 120
         <xsl:attribute name="title"><xsl:value-of select="."  disable-output-escaping="yes" /></xsl:attribute>
103 121
       </xsl:element>
104 122
     </xsl:for-each>
105
-    
123
+
106 124
     <xsl:for-each select="/buildinfo/document/author">
107 125
       <xsl:variable name="id">
108 126
         <xsl:value-of select="@id" />
@@ -121,7 +139,7 @@
121 139
         </xsl:attribute>
122 140
       </xsl:element>
123 141
     </xsl:for-each>
124
-    
142
+
125 143
     <!-- Twitter and Facebook sharing cards -->
126 144
     <xsl:variable name="metadesc">
127 145
       <!-- Get the meta element description -->
@@ -131,7 +149,7 @@
131 149
       <!-- Get the meta element description -->
132 150
       <xsl:value-of select="head/meta[@name = 'image']/@content" />
133 151
     </xsl:variable>
134
-    
152
+
135 153
     <!-- EXTRACT -->
136 154
     <!-- take a first extract which should be sufficient for most pages -->
137 155
     <xsl:variable name="extract1">
@@ -172,7 +190,7 @@
172 190
         </xsl:otherwise>
173 191
       </xsl:choose>
174 192
     </xsl:variable>
175
-        
193
+
176 194
     <!-- Twitter cards -->
177 195
     <xsl:element name="meta">
178 196
       <xsl:attribute name="name">twitter:card</xsl:attribute>
@@ -183,7 +201,7 @@
183 201
           <xsl:otherwise>summary</xsl:otherwise>
184 202
         </xsl:choose>
185 203
       </xsl:attribute>
186
-    </xsl:element>    
204
+    </xsl:element>
187 205
     <meta name="twitter:site" content="@fsfe" />
188 206
     <xsl:element name="meta">
189 207
       <xsl:attribute name="name">twitter:image</xsl:attribute>
@@ -214,7 +232,7 @@
214 232
             <xsl:choose>
215 233
               <!-- if not, try to get the short extract -->
216 234
               <xsl:when test="$extract != ''"><xsl:value-of select="$extract" /><xsl:text>...</xsl:text></xsl:when>
217
-              <!-- if even that isn't available, return a default text 
235
+              <!-- if even that isn't available, return a default text
218 236
                    (not language sensitive). This should never be the case... -->
219 237
               <xsl:otherwise>Non profit organisation working to create general understanding and support for software freedom. Includes news, events, and campaigns.</xsl:otherwise>
220 238
             </xsl:choose>
@@ -262,7 +280,7 @@
262 280
             <xsl:choose>
263 281
               <!-- if not, try to get the short extract -->
264 282
               <xsl:when test="$extract != ''"><xsl:value-of select="$extract" /><xsl:text>...</xsl:text></xsl:when>
265
-              <!-- if even that isn't available, return a default text 
283
+              <!-- if even that isn't available, return a default text
266 284
                    (not language sensitive). This should never be the case... -->
267 285
               <xsl:otherwise>Non profit organisation working to create general understanding and support for software freedom. Includes news, events, and campaigns.</xsl:otherwise>
268 286
             </xsl:choose>
@@ -281,7 +299,7 @@
281 299
     <xsl:comment><![CDATA[[if (lt IE 9) & (!IEMobile)]>
282 300
          <link rel="stylesheet" media="all" href="/look/ie.min.css" type="text/css">
283 301
         <![endif]]]></xsl:comment>
284
-    
302
+
285 303
     <!-- Copy head element from the xhtml source file (and possibly from external xsl rules) -->
286 304
     <xsl:apply-templates select="head/node()" />
287 305
   </xsl:element></xsl:template>

+ 5
- 0
environment.xsl View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
+  <xsl:variable name="environment" select="'development'" />
5
+</xsl:stylesheet>

+ 5
- 0
environment.xsl.prod View File

@@ -0,0 +1,5 @@
1
+<?xml version="1.0" encoding="utf-8"?>
2
+
3
+<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform">
4
+  <xsl:variable name="environment" select="'production'" />
5
+</xsl:stylesheet>

+ 0
- 15
look/fsfe.min.css
File diff suppressed because it is too large
View File


+ 18
- 0
scripts/less.min.js
File diff suppressed because it is too large
View File


Loading…
Cancel
Save