SlideShare a Scribd company logo
1 of 19
Download to read offline
The Dojo Build System
    Tobias von Klipstein - uxebu Ltd.
         klipstein@uxebu.com
What?
• Process for
 • compressing your JS files
 • grouping several JS files into one
 • interning external non-JS files (HTML
    Templates)
 • resolving of css @import statements
                 Speed up your app
We need?

• Dojo source release
• Java 1.5 (recommended) for running Rhino
• A Dojo application, we want to optimize
Dojo Source Release

• dojo (Base / Core)
• dijit
• dojox
• util (Rhino / Shrinksafe)
Our App
GET index.html
                    index.html


             @import url(quot;dojo.cssquot;);
                     dojo.css

            @import url(quot;tundra.cssquot;);
                    tundra.css

         @import quot;dijit/form/Button.cssquot;;
              dijit/form/Button.css
                        ...




Client
                                             Webserver




          <script src=“dojo.js“></script>
                      dojo.js

         dojo.require(“dijit.form.Button“)
                dijit/form/Button.js
                                                         Usual Page Load




            dojo.require(“dojo.string“)
                   dojo/string.js
                        ...
GET index.html
                   index.html




               @import style.css
                    style.css




Client
                                           Webserver




         <script src=“dojo.js“></script>
                                                       Optimized Page Load




                     dojo.js
Build Profile (1)

•   like ant‘s build.xml or Makefiles

•   consists of

    •   layers

    •   modules

•   util/buildscripts/profiles/<profile name>.profile.js
Build Profile (2)
 The simplest build profile


            ¶
Build profile (3)
dependencies = {
   layers: [
      {
         //always quot;../[....]quot; or just quot;dojo.jsquot;
         name: quot;../beer/layername.jsquot;,
          dependencies: [
             quot;dojo.stringquot;
             quot;dijit.form.Buttonquot;
          ],
         //relative to the util/buildscripts
         //directory or an absolute path.
         copyrightFile: quot;myCopyright.txtquot;
      }
   ],
   prefixes: [
      //relative to the dojo/dojo.js file
      [quot;dijitquot;, quot;../dijitquot;,
      [quot;beerquot;, quot;../beerquot;, quot;../beer/copyright.txtquot;],
   ]
};
Doing a Build

• cd util/buildscripts
• build.sh [or .bat]
     profile=<profile name>
     action=release
     + [more options]
build.sh [options] (1)

• releaseName [default: dojo]
• releaseDir [default: ../../release/]
• version [default: 0.0.0.dev]
• profileFile (instead of profile option)
• localeList [default: de-de, en-gb, ...]
build.sh [options] (2)


• loader [default or xdomain]
• scopeDjConfig
build.sh [options] (3)
• cssOptimize (comments or
  comments.keepLines)
• optimize (shrinksafe / shrinksafe.keepLines /
  packer)
• layerOptimize [default: shrinksafe]
• mini [default: false]
Shrinksafe (1)

• removing whitespace
• removing comments
• replacing non-public symbols (argument /
  variable / function names) with shorter
  ones
Shrinksafe (2)

function MyClass(){
    this.foo = function(argument1, argument2)
{
        var addedArgs = parseInt(argument1)+    function MyClass(){
                        parseInt(argument2);    this.foo=function(_1,_2){
        return addedArgs;                       var _3=parseInt(_1)+parseInt(_2);
    }                                           return _3;
    var anonymousInnerFunction = function(){    };
        // do stuff here!                       var _4=function(){
    }                                           };
}                                               }
function MyFunc(){                              function MyFunc(){
    // this is a top-level function             }
}
// we've got multiple lines of whitespace
here
Let‘s build


./build.sh profile=beer action=clean,release
What else you can do?
• Use a CDN (if just <5 modules are used)
• GZIP your content
• Loading your javascript files at the end and
  CSS upfront
• Creating a separate domain for your js
  files: js.example.com (xdomain)
• Determine often used modules (regularly)
Links
• docs.dojocampus.org/quickstart/custom-
  builds
• dojotoolkit.org/docs/shrinksafe
• dojocampus.org/content/2008/05/03/dojo-
  build-101-basics/
• dojocampus.org/content/2008/05/26/dojo-
  build-201-layers-and-css-optimizing-builds/
• download.dojotoolkit.org (source release)

More Related Content

What's hot

Web UI performance tuning
Web UI performance tuningWeb UI performance tuning
Web UI performance tuning
Andy Pemberton
 
C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱
NAVER D2
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
Netvibes
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
taggg
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
Laurence Svekis ✔
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Jeado Ko
 

What's hot (20)

Geb presentation
Geb presentationGeb presentation
Geb presentation
 
JavaScript Performance Patterns
JavaScript Performance PatternsJavaScript Performance Patterns
JavaScript Performance Patterns
 
前端概述
前端概述前端概述
前端概述
 
Web UI performance tuning
Web UI performance tuningWeb UI performance tuning
Web UI performance tuning
 
High Performance Social Plugins
High Performance Social PluginsHigh Performance Social Plugins
High Performance Social Plugins
 
React.js触ってみた 吉澤和香奈
React.js触ってみた 吉澤和香奈React.js触ってみた 吉澤和香奈
React.js触ってみた 吉澤和香奈
 
the 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp IIthe 5 layers of web accessibility - Open Web Camp II
the 5 layers of web accessibility - Open Web Camp II
 
Custom gutenberg block development in react
Custom gutenberg block development in reactCustom gutenberg block development in react
Custom gutenberg block development in react
 
C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱C3 웹기술로만드는모바일앱
C3 웹기술로만드는모바일앱
 
Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007Netvibes UWA workshop at ParisWeb 2007
Netvibes UWA workshop at ParisWeb 2007
 
Odoo - Create themes for website
Odoo - Create themes for websiteOdoo - Create themes for website
Odoo - Create themes for website
 
HTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymoreHTML5: where flash isn't needed anymore
HTML5: where flash isn't needed anymore
 
Mojolicious, real-time web framework
Mojolicious, real-time web frameworkMojolicious, real-time web framework
Mojolicious, real-time web framework
 
JavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your codeJavaScript Advanced - Useful methods to power up your code
JavaScript Advanced - Useful methods to power up your code
 
Bootstrap과 UI-Bootstrap
Bootstrap과 UI-BootstrapBootstrap과 UI-Bootstrap
Bootstrap과 UI-Bootstrap
 
Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!Mojolicious. Веб в коробке!
Mojolicious. Веб в коробке!
 
SocketStream
SocketStreamSocketStream
SocketStream
 
Hack tutorial
Hack tutorialHack tutorial
Hack tutorial
 
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
Yuriy Voziy "Fantastic Template Strings and Where to Use Them"
 
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
Angular를 활용한 웹 프론트단 개발과 2.0에서 달라진점
 

Similar to The Dojo Build System

Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
Doris Chen
 
Widget Summit 2008
Widget Summit 2008Widget Summit 2008
Widget Summit 2008
Volkan Unsal
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
Justin Cataldo
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
Ortus Solutions, Corp
 

Similar to The Dojo Build System (20)

Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Meetup Performance
Meetup PerformanceMeetup Performance
Meetup Performance
 
Ajax Performance Tuning and Best Practices
Ajax Performance Tuning and Best PracticesAjax Performance Tuning and Best Practices
Ajax Performance Tuning and Best Practices
 
IOC + Javascript
IOC + JavascriptIOC + Javascript
IOC + Javascript
 
Profiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / WebgrindProfiling PHP with Xdebug / Webgrind
Profiling PHP with Xdebug / Webgrind
 
Javascript first-class citizenery
Javascript first-class citizeneryJavascript first-class citizenery
Javascript first-class citizenery
 
YUI 3
YUI 3YUI 3
YUI 3
 
企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践企业级软件的组件化和动态化开发实践
企业级软件的组件化和动态化开发实践
 
Widget Summit 2008
Widget Summit 2008Widget Summit 2008
Widget Summit 2008
 
#NewMeetup Performance
#NewMeetup Performance#NewMeetup Performance
#NewMeetup Performance
 
Javascript ui for rest services
Javascript ui for rest servicesJavascript ui for rest services
Javascript ui for rest services
 
mago3D Technical Workshop Material
mago3D Technical Workshop Material mago3D Technical Workshop Material
mago3D Technical Workshop Material
 
dojo.Patterns
dojo.Patternsdojo.Patterns
dojo.Patterns
 
Trimming The Cruft
Trimming The CruftTrimming The Cruft
Trimming The Cruft
 
How Akamai Made ESI Testing Simpler
How Akamai Made ESI Testing SimplerHow Akamai Made ESI Testing Simpler
How Akamai Made ESI Testing Simpler
 
IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009IPhone Web Development With Grails from CodeMash 2009
IPhone Web Development With Grails from CodeMash 2009
 
More Secrets of JavaScript Libraries
More Secrets of JavaScript LibrariesMore Secrets of JavaScript Libraries
More Secrets of JavaScript Libraries
 
Building a Single Page Application using Ember.js ... for fun and profit
Building a Single Page Application using Ember.js ... for fun and profitBuilding a Single Page Application using Ember.js ... for fun and profit
Building a Single Page Application using Ember.js ... for fun and profit
 
Into The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and dockerInto The Box 2018 Going live with commandbox and docker
Into The Box 2018 Going live with commandbox and docker
 
Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018Going live with BommandBox and docker Into The Box 2018
Going live with BommandBox and docker Into The Box 2018
 

Recently uploaded

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Recently uploaded (20)

HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 

The Dojo Build System

  • 1. The Dojo Build System Tobias von Klipstein - uxebu Ltd. klipstein@uxebu.com
  • 2. What? • Process for • compressing your JS files • grouping several JS files into one • interning external non-JS files (HTML Templates) • resolving of css @import statements Speed up your app
  • 3. We need? • Dojo source release • Java 1.5 (recommended) for running Rhino • A Dojo application, we want to optimize
  • 4. Dojo Source Release • dojo (Base / Core) • dijit • dojox • util (Rhino / Shrinksafe)
  • 6. GET index.html index.html @import url(quot;dojo.cssquot;); dojo.css @import url(quot;tundra.cssquot;); tundra.css @import quot;dijit/form/Button.cssquot;; dijit/form/Button.css ... Client Webserver <script src=“dojo.js“></script> dojo.js dojo.require(“dijit.form.Button“) dijit/form/Button.js Usual Page Load dojo.require(“dojo.string“) dojo/string.js ...
  • 7. GET index.html index.html @import style.css style.css Client Webserver <script src=“dojo.js“></script> Optimized Page Load dojo.js
  • 8. Build Profile (1) • like ant‘s build.xml or Makefiles • consists of • layers • modules • util/buildscripts/profiles/<profile name>.profile.js
  • 9. Build Profile (2) The simplest build profile ¶
  • 10. Build profile (3) dependencies = { layers: [ { //always quot;../[....]quot; or just quot;dojo.jsquot; name: quot;../beer/layername.jsquot;, dependencies: [ quot;dojo.stringquot; quot;dijit.form.Buttonquot; ], //relative to the util/buildscripts //directory or an absolute path. copyrightFile: quot;myCopyright.txtquot; } ], prefixes: [ //relative to the dojo/dojo.js file [quot;dijitquot;, quot;../dijitquot;, [quot;beerquot;, quot;../beerquot;, quot;../beer/copyright.txtquot;], ] };
  • 11. Doing a Build • cd util/buildscripts • build.sh [or .bat] profile=<profile name> action=release + [more options]
  • 12. build.sh [options] (1) • releaseName [default: dojo] • releaseDir [default: ../../release/] • version [default: 0.0.0.dev] • profileFile (instead of profile option) • localeList [default: de-de, en-gb, ...]
  • 13. build.sh [options] (2) • loader [default or xdomain] • scopeDjConfig
  • 14. build.sh [options] (3) • cssOptimize (comments or comments.keepLines) • optimize (shrinksafe / shrinksafe.keepLines / packer) • layerOptimize [default: shrinksafe] • mini [default: false]
  • 15. Shrinksafe (1) • removing whitespace • removing comments • replacing non-public symbols (argument / variable / function names) with shorter ones
  • 16. Shrinksafe (2) function MyClass(){ this.foo = function(argument1, argument2) { var addedArgs = parseInt(argument1)+ function MyClass(){ parseInt(argument2); this.foo=function(_1,_2){ return addedArgs; var _3=parseInt(_1)+parseInt(_2); } return _3; var anonymousInnerFunction = function(){ }; // do stuff here! var _4=function(){ } }; } } function MyFunc(){ function MyFunc(){ // this is a top-level function } } // we've got multiple lines of whitespace here
  • 18. What else you can do? • Use a CDN (if just <5 modules are used) • GZIP your content • Loading your javascript files at the end and CSS upfront • Creating a separate domain for your js files: js.example.com (xdomain) • Determine often used modules (regularly)
  • 19. Links • docs.dojocampus.org/quickstart/custom- builds • dojotoolkit.org/docs/shrinksafe • dojocampus.org/content/2008/05/03/dojo- build-101-basics/ • dojocampus.org/content/2008/05/26/dojo- build-201-layers-and-css-optimizing-builds/ • download.dojotoolkit.org (source release)