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