]>
Commit | Line | Data |
---|---|---|
6527f429 DM |
1 | <project name="x-sass-impl">\r |
2 | \r | |
3 | <!--\r | |
4 | Uses the compiler to generate the top-level scss file for the app\r | |
5 | by using the current set of js files to determine the Components\r | |
6 | used by the app, then including the corresponding scss files into the \r | |
7 | app's style\r | |
8 | -->\r | |
9 | <target name="-compile-sass" depends="-init-app-js-files">\r | |
10 | <local name="app.out.scss.tmp"/>\r | |
11 | <local name="sass.name.filter"/>\r | |
12 | <property name="app.out.scss.tmp" value="${app.out.scss}.tmp"/>\r | |
13 | <x-normalize-path \r | |
14 | path="${build.out.resources.dir}" \r | |
15 | property="image.search.path"/>\r | |
16 | \r | |
17 | <if>\r | |
18 | <x-is-true value="${build.include.all.scss}"/>\r | |
19 | <then>\r | |
20 | <property name="sass.name.filter">\r | |
21 | include\r | |
22 | -all\r | |
23 | </property>\r | |
24 | </then>\r | |
25 | </if>\r | |
26 | <property name="sass.name.filter">\r | |
27 | restore\r | |
28 | page\r | |
29 | </property>\r | |
30 | \r | |
31 | <local name="var.begin"/>\r | |
32 | <local name="var.end"/>\r | |
33 | <local name="resource.map.base"/>\r | |
34 | \r | |
35 | <condition property="var.begin" value="dynamic(">\r | |
36 | <isset property="framework.isV6"/>\r | |
37 | </condition>\r | |
38 | <condition property="var.end" value=")">\r | |
39 | <isset property="framework.isV6"/>\r | |
40 | </condition>\r | |
41 | \r | |
42 | <property name="var.begin" value=""/>\r | |
43 | <property name="var.end" value="!default"/>\r | |
44 | \r | |
45 | <condition property="resource.map.base" value="${css.output.rel.path}">\r | |
46 | <x-is-true value="${app.sass.dynamic}"/>\r | |
47 | </condition>\r | |
48 | <property name="resource.map.base" value=""/>\r | |
49 | \r | |
50 | <if>\r | |
51 | <x-is-true value="${app.sass.dynamic}"/>\r | |
52 | <then>\r | |
53 | <x-get-relative-path\r | |
54 | from="${build.out.css.dir}"\r | |
55 | to="${build.out.base.path}"\r | |
56 | property="css.output.rel.path"/>\r | |
57 | </then>\r | |
58 | </if>\r | |
59 | \r | |
60 | <property name="css.output.rel.path" value=""/>\r | |
61 | \r | |
62 | <x-compile refid="${compiler.ref.id}">\r | |
63 | <![CDATA[\r | |
64 | ${sass.name.filter}\r | |
65 | and\r | |
66 | #only set variables for used classes eg. $include-class-name\r | |
67 | sass\r | |
68 | +class-name-vars\r | |
69 | -variable=$app-name: ${var.begin} '${app.name}' ${var.end}\r | |
70 | -variable=$image-search-path:'${image.search.path}'\r | |
71 | -variable=$theme-name: ${var.begin} '${theme.name}' ${var.end}\r | |
72 | -resourceMapBase=${css.output.rel.path}\r | |
73 | -output=${app.out.scss.tmp}\r | |
74 | -forward=${app.sass.dynamic}\r | |
75 | and\r | |
76 | include\r | |
77 | -all\r | |
78 | and\r | |
79 | # include etc and vars from all classes\r | |
80 | sass\r | |
81 | +etc\r | |
82 | +vars\r | |
83 | +append\r | |
84 | -output=${app.out.scss.tmp}\r | |
85 | -forward=${app.sass.dynamic}\r | |
86 | and\r | |
87 | ${sass.name.filter}\r | |
88 | and\r | |
89 | #only include rules from used classes\r | |
90 | sass\r | |
91 | +rules\r | |
92 | +append\r | |
93 | -output=${app.out.scss.tmp}\r | |
94 | and\r | |
95 | sass\r | |
96 | +ruby\r | |
97 | -sassCacheDir=${compass.cache.dir}\r | |
98 | -output=${app.out.ruby}\r | |
99 | ]]>\r | |
100 | </x-compile>\r | |
101 | \r | |
102 | <if>\r | |
103 | <not>\r | |
104 | <filesmatch file1="${app.out.scss.tmp}" file2="${app.out.scss}"/>\r | |
105 | </not>\r | |
106 | <then>\r | |
107 | <copy file="${app.out.scss.tmp}" tofile="${app.out.scss}" overwrite="true"/>\r | |
108 | </then>\r | |
109 | </if>\r | |
110 | \r | |
111 | <!--\r | |
112 | app.out.css.path is relative to the app output index.html file\r | |
113 | -->\r | |
114 | <x-get-relative-path\r | |
115 | from="${app.dir}"\r | |
116 | to="${app.out.css}"\r | |
117 | property="app.out.css.path"\r | |
118 | />\r | |
119 | \r | |
120 | <!--update the application's bootstrap.css file to point to the build output-->\r | |
121 | <echo file="${build.bootstrap.css.path}">\r | |
122 | <![CDATA[\r | |
123 | /*\r | |
124 | * This file is generated by Sencha Cmd and should NOT be edited. It redirects\r | |
125 | * to the most recently built CSS file for the application to allow index.html\r | |
126 | * in the development directory to load properly (i.e., "dev mode").\r | |
127 | */\r | |
128 | @import '${app.out.css.path}';\r | |
129 | ]]>\r | |
130 | </echo>\r | |
131 | </target>\r | |
132 | \r | |
133 | <!--\r | |
134 | This macrodef is used for post-processing Ext JS 4.2+ style theme css files\r | |
135 | and will split based on selector thresholds, as well as run the css preprocessor\r | |
136 | and compressor\r | |
137 | -->\r | |
138 | <macrodef name="x-compress-css-files">\r | |
139 | <attribute name="dir"/>\r | |
140 | <attribute name="prefix"/>\r | |
141 | <attribute name="outprefix"/>\r | |
142 | <attribute name="compress"/>\r | |
143 | <attribute name="preprocess"/>\r | |
144 | <sequential>\r | |
145 | <x-split-css file="@{dir}/@{prefix}.css"\r | |
146 | outdir="${build.resources.dir}"\r | |
147 | limit="${build.css.selector.limit}"\r | |
148 | compilerRefId="${compiler.ref.id}"/>\r | |
149 | \r | |
150 | <for param="cssfile">\r | |
151 | <fileset dir="@{dir}" includes="@{prefix}*.css"/>\r | |
152 | <sequential>\r | |
153 | <local name="css.output.name"/>\r | |
154 | <local name="pattern"/>\r | |
155 | <property name="pattern" value="(.*?)(@{prefix})(_\d{1,2})*\.css"/>\r | |
156 | <propertyregex property="css.output.name"\r | |
157 | input="@{cssfile}"\r | |
158 | regexp="${pattern}"\r | |
159 | select="\1@{outprefix}\3.css"\r | |
160 | override="true"/>\r | |
161 | <if>\r | |
162 | <equals arg1="@{preprocess}" arg2="true"/>\r | |
163 | <then>\r | |
164 | <x-echo>Preprocessing @{cssfile} to ${css.output.name}</x-echo>\r | |
165 | <x-css-preprocess \r | |
166 | file="@{cssfile}" \r | |
167 | tofile="${css.output.name}" \r | |
168 | options="${build.css.preprocessor.opts}"/>\r | |
169 | </then>\r | |
170 | </if>\r | |
171 | <if>\r | |
172 | <equals arg1="@{compress}" arg2="true"/>\r | |
173 | <then>\r | |
174 | <x-echo>Compressing @{cssfile} to ${css.output.name}</x-echo>\r | |
175 | <x-compress-css srcfile="@{cssfile}"\r | |
176 | outfile="${css.output.name}"/>\r | |
177 | </then>\r | |
178 | </if>\r | |
179 | </sequential>\r | |
180 | </for>\r | |
181 | </sequential>\r | |
182 | </macrodef>\r | |
183 | \r | |
184 | <!--\r | |
185 | This target builds Ext JS 4.2+ style themes, first generating the top-level\r | |
186 | scss file, then running compass with the css, sass, and config options set\r | |
187 | -->\r | |
188 | <target name="-compass-compile-theme-package" depends="-load-sass-page">\r | |
189 | <x-run-if-true value="${enable.ext42.themes}">\r | |
190 | <local name="compress.uptodate"/>\r | |
191 | \r | |
192 | <x-ant-call target="-compile-sass"/>\r | |
193 | \r | |
194 | <if>\r | |
195 | <x-is-true value="${app.sass.fashion}"/>\r | |
196 | <then>\r | |
197 | <if>\r | |
198 | <x-is-true value="${app.sass.rhino}"/>\r | |
199 | <then>\r | |
200 | <x-fashion-compile\r | |
201 | file="${app.out.scss}"\r | |
202 | toFile="${app.out.css}"/>\r | |
203 | </then>\r | |
204 | <else>\r | |
205 | <x-sass-build input="${app.out.scss}"\r | |
206 | output="${app.out.css}"\r | |
207 | refId="app.web.server"\r | |
208 | split="${build.css.selector.limit}"\r | |
209 | compress="${build.css.compress}"\r | |
210 | updateSplitFiles="true"\r | |
211 | compilerRefId="${compiler.ref.id}"/>\r | |
212 | </else>\r | |
213 | </if>\r | |
214 | </then>\r | |
215 | <else>\r | |
216 | <x-compass-compile\r | |
217 | rubyPath="${build.ruby.path}"\r | |
218 | dir="${compass.working.dir}"\r | |
219 | trace="${compass.compile.trace}"\r | |
220 | boring="${compass.compile.boring}"\r | |
221 | force="${compass.compile.force}"\r | |
222 | sassdir="${compass.sass.dir}"\r | |
223 | cssdir="${compass.css.dir}"\r | |
224 | config="${compass.config.file}"/>\r | |
225 | \r | |
226 | <uptodate property="compress.uptodate"\r | |
227 | value="true"\r | |
228 | srcfile="${app.out.scss}.tmp"\r | |
229 | targetfile="${app.out.css}"/>\r | |
230 | \r | |
231 | <if>\r | |
232 | <x-is-true value="${compress.uptodate}"/>\r | |
233 | <!--<x-is-true value="true"/>-->\r | |
234 | <then>\r | |
235 | <x-compress-css-files dir="${build.out.css.dir}"\r | |
236 | prefix="${app.out.base.debug}"\r | |
237 | outprefix="${app.out.base}"\r | |
238 | preprocess="${build.css.preprocess}"\r | |
239 | compress="${build.css.compress}"/>\r | |
240 | </then>\r | |
241 | </if>\r | |
242 | </else>\r | |
243 | </if>\r | |
244 | </x-run-if-true>\r | |
245 | </target>\r | |
246 | \r | |
247 | <!--\r | |
248 | This is a legacy macrodef to support building Ext JS 4.1 themes, which have been\r | |
249 | deprecated in favor of Ext JS 4.2 theme packages\r | |
250 | -->\r | |
251 | <macrodef name="x-build-sass">\r | |
252 | <attribute name="theme"/>\r | |
253 | <sequential>\r | |
254 | <local name="sass.name"/>\r | |
255 | <local name="use.shell"/>\r | |
256 | \r | |
257 | <!--\r | |
258 | convert abspath to just the leaf path name\r | |
259 | -->\r | |
260 | <basename property="sass.name" file="@{theme}"/>\r | |
261 | <local name="sass.base.name"/>\r | |
262 | <property name="sass.base.name" value="${sass.name}"/>\r | |
263 | \r | |
264 | <echo>Compiling sass directory : @{theme}/sass</echo>\r | |
265 | <x-compass-compile\r | |
266 | rubyPath="${build.ruby.path}"\r | |
267 | boring="${compass.compile.boring}"\r | |
268 | force="${compass.compile.force}"\r | |
269 | trace="${compass.compile.trace}"\r | |
270 | dir="@{theme}/sass"/>\r | |
271 | \r | |
272 | <x-compress-css srcfile="${app.dir}/resources/${sass.base.name}/*.css"\r | |
273 | outdir="${app.dir}/resources/${sass.base.name}"/>\r | |
274 | </sequential>\r | |
275 | </macrodef>\r | |
276 | \r | |
277 | <!--\r | |
278 | This target builds Ext JS 4.1 style themes, iterating over each directory\r | |
279 | under the specified ${app.theme.dir} directory and compiling the sass \r | |
280 | located there\r | |
281 | -->\r | |
282 | <target name="-compass-compile-theme-folders">\r | |
283 | <x-run-if-true value="${enable.ext41.themes}">\r | |
284 | <!-- run sass compilation over the various themes -->\r | |
285 | <for param="sass">\r | |
286 | <dirset dir="${app.theme.dir}" includes="*"/>\r | |
287 | <sequential>\r | |
288 | <x-build-sass theme="@{sass}"/>\r | |
289 | </sequential>\r | |
290 | </for>\r | |
291 | </x-run-if-true>\r | |
292 | </target>\r | |
293 | \r | |
294 | <!--\r | |
295 | This target builds Touch style themes, by running compass\r | |
296 | over the directory containing the manually maintined scss files\r | |
297 | -->\r | |
298 | <target name="-compass-compile-sass-dir">\r | |
299 | <x-run-if-true value="${enable.touch.themes}">\r | |
300 | <x-compass-compile\r | |
301 | rubyPath="${build.ruby.path}"\r | |
302 | trace="${compass.compile.trace}"\r | |
303 | boring="${compass.compile.boring}"\r | |
304 | force="${compass.compile.force}"\r | |
305 | dir="${compass.sass.dir}"/>\r | |
306 | </x-run-if-true>\r | |
307 | </target>\r | |
308 | \r | |
309 | <!--\r | |
310 | This is a summation target triggering the three different supported\r | |
311 | sass modes (ext 41, ext 42+, and touch). \r | |
312 | -->\r | |
313 | <target name="-compass-compile"\r | |
314 | depends="-compass-compile-theme-package,\r | |
315 | -compass-compile-theme-folders,\r | |
316 | -compass-compile-sass-dir"/>\r | |
317 | \r | |
318 | <!--\r | |
319 | Build SASS\r | |
320 | -->\r | |
321 | <target name="-before-sass"/>\r | |
322 | <target name="-sass" depends="-compass-compile"/>\r | |
323 | <target name="-after-sass"/>\r | |
324 | </project>\r |