Comments (9)
It'd be cool but mostly we'd require your help in adding the feature. :)
from ant-build-script.
Sounds good to me. I've already forked it and modifying the build.xml to account for requirejs/amd. Can this ticket be assigned to me?
from ant-build-script.
can't assign it to you but you certainly own it. (in our hearts)
from ant-build-script.
How do you picture this working, from an end user perspective?
Also, in lieu of assigning it to you, I can walk downstairs every couple of hours to see how it's going...
from ant-build-script.
@roblarsen I was thinking of basically including the option to set a property, named script.amd, within project.properties to something like amd or amd.jquery with the default being empty for the default behavior that we currently see.
This is what I was thinking of doing, its a bit messy but I'll clean it up eventually before submitting a request:
<echo message="Update the HTML to reference our concatenated script file: ${scripts.js}"/>
<!-- Determines which Regex to use for AMD use -->
<if>
<equals arg1="${script.type}" arg2="amd"/>
<then>
<echo message="Updating HTML to reflect the use of RequireJS"/>
<property name="matchRegex" value="<!-- scripts concatenated [\d\w\s\W]*<script.*data-main=['"]?(.*)/${file.root.script}(?:\?.*)?['"]?\s*>\s*</script>[\d\w\s\W]*<!-- end ((scripts)|(concatenated and minified scripts))\s*-->" />
<property name="replaceRegex" value="<script data-main='\1/${scripts.sha}.js\' src='js/require.js'></script>" />
</then>
<elseif>
<equals arg1="${script.type}" arg2="amd.jquery"/>
<then>
<echo message="Updating HTML to reflect the use of RequireJS with jQuery"/>
<property name="matchRegex" value="<!-- scripts concatenated [\d\w\s\W]*<script.*data-main=['"]?(.*)/${file.root.script}(?:\?.*)?['"]?\s*>\s*</script>[\d\w\s\W]*<!-- end ((scripts)|(concatenated and minified scripts))\s*-->" />
<property name="replaceRegex" value="<script data-main='\1/${scripts.sha}.js\' src='js/require-jquery.js'></script>" />
</then>
</elseif>
<else>
<echo message="Updating HTML to reflect the use of default script inclusion"/>
<property name="matchRegex" value="<!-- scripts concatenated [\d\w\s\W]*<script.*src=['"]?(.*)/${file.root.script}(?:\?.*)?['"]?\s*>\s*</script>[\d\w\s\W]*<!-- end ((scripts)|(concatenated and minified scripts))\s*-->" />
<property name="replaceRegex" value="<script src='\1/${scripts.sha}.js\'></script>" />
</else>
</if>
<!-- style.css replacement handled as a replacetoken above -->
<replaceregexp match="${matchRegex}"
replace="${replaceRegex}" flags="m">
<fileset dir="${dir.intermediate}" includes="${page-files}"/>
</replaceregexp>
<!--[! use comments like this one to avoid having them get minified -->
And in project.properties:
# Optional property used to determine whether to use require.js implementation of AMD
# Note: Make sure to include require.js here: js/libs/
# Set to amd to output: <script data-main='js/hash.js' src='js/require.js'></script>
# Set to amd.jquery to output: <script data-main='js/hash.js' src='js/require-jquery.js'></script>
# If using amd.jquery remember to remove the jquery files in js/libs and the markup within index.html
script.type = amd.jquery
from ant-build-script.
I think it makes sense to set the path to require as a property. We're not shipping it, so we can't rely on it working. If we require that people set the path to require in the project properties it will force them to acknowledge that the file needs to be there and will allow them to place it anywhere (local file system, CDN) without having to touch the XML.
from ant-build-script.
Good idea! I didn't think about that one. Ill switch it out to use a path instead.
from ant-build-script.
Yeah, generally we want to avoid having people touch the XML. Especially for something like a path, which is an easy substitution.
from ant-build-script.
making magic.
from ant-build-script.
Related Issues (20)
- Change docs to address confusion HOT 2
- Can't copy minified js directory over to publish HOT 2
- Concatenation after minifying and ADVANCED_OPTIMIZATIONS HOT 5
- Image Optimization Broken on Linux/Mac HOT 9
- Minifying any unconcatenated css files... FileNotFoundException HOT 2
- The gem-sass.jar throws an exception with Foundation 4 HOT 3
- Image Optimization HOT 5
- Rework Image Optimization HOT 15
- CSS reference not updating w/php includes on build HOT 6
- Mavericks Upgrade: Busted Macports for Ant HOT 2
- Unicode characters being inserted between css imports upon concatenation. HOT 5
- css-references not updating in html-file HOT 17
- working with sass stylesheets HOT 1
- problem with advpng and java.. HOT 5
- set language_in option for closure compiler? HOT 6
- Port to NodeJs HOT 1
- css does not minify/concat correctly when using default main.css HOT 7
- ant validate only validates single page HOT 1
- JS files vanished in publish/ directory HOT 1
- How to use this build script outside my project? HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ant-build-script.