• This repository has been archived on 10/Jan/2020
  • Stars
    star
    131
  • Rank 267,209 (Top 6 %)
  • Language
    JavaScript
  • License
    Other
  • Created over 15 years ago
  • Updated over 11 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

DEPRECATED - YUI Build Tool

Welcome to YUI Builder

This repo has been deprecated in favor of Shifter.

Introduction

YUI uses ANT to create component build files from individual source files.

Each component has its own ANT build file residing in the component's source folder with an associated properties file used to define build parameters specific to the component e.g:

yui2/src/autocomplete/build.xml yui2/src/autocomplete/build.properties

The component build will automate the conversion from component source to .js, -min.js, -debug.js by:

a) Concatenating individual source files b) Stripping logger statements c) Compressing files, using yuicompressor d) Running jslint on all 3 built files e) Adding boiler plate module/version registration code f) Building skin files from -core.css, -skin.css g) Deploying built JS, CSS and assets to /build

The same component build system is also used for CSS components such as reset, base, fonts and grids.

The component build does not currently:

a) Check in any code

The developer is responsible for checking modified source code into the /src directory, and built code into the /build directory, allowing them to review diffs, before committing changes.

b) Generate API documentation

Installation

Below is a brief summary as well as a detailed step-by-step guide for installing the build system, allowing you to build the "src" component code.

Summary

  1. Install ANT 1.7 or above, and add ant to your path

  2. Clone the YUI "builder" project from http://github.com/yui/builder/

  3. At the command line, cd to the source directory of the component you wish to build, and execute "ant all" to build, e.g.:

    prompt> cd yui2/src/autocomplete prompt> ant all

Detailed Instructions

To use the build system, you'll need to install ANT and obtain the YUI build infrastructure from github.

These are both one-time install tasks.

Installing Ant

  1. Download and install ANT 1.7 (or above)

    http://ant.apache.org/bindownload.cgi

  2. Be sure to define an ANT_HOME environment variable to point to your ANT install root, and add the ANT executable to your environment's PATH variable.

Installing YUI Build Infrastructure

  1. Clone the YUI "builder" project from github:

    http://github.com/yui/builder/

    This project contains the files used by the YUI ant build process.

  2. Out of the box, the build system is designed to work when cloned to the default "builder" directory, parallel to the project source directories:

    /yui2 ( cloned yui2 project ) /yui3 ( cloned yui2 project ) /builder ( cloned builder project )

    Cloning it to the default location will allow you to build any of the components without having to modify any component build scripts.

    NOTE: YUI Builder is also available for download as a zip from http://yuilibrary.com/downloads. If downloading from this location to build yui2 or yui3 source, make sure to unzip the contents into the directory structure mentioned above, to have the build work out of the box.

Building An Existing Component

With ANT and the YUI build infrastructure installed, you can now build any of the components from source, using the build.xml file in the component's source directory.

The build system allows you to build locally, within the component's source directory, and also run a full build to update the top level build directory for a component.

Full Build

To perform a full build for a component, run ant with the "all" target:

e.g:

prompt> cd yui2/src/autocomplete
prompt> ant all

The "all" build target will build the component from its source files AND deploy the built files, as well as any assets, to the top level build folder:

<project>/build/<component>

So, for autocomplete, the built files would be copied to:

yui2/build/autocomplete

NOTE: When invoking ant without a file argument, as we do above, it will use build.xml, if present in the current directory - which is what we want.

LOCAL BUILD

To perform a local build for a component, run ant without a target:

e.g:

prompt> cd yui2/src/autocomplete
prompt> ant

This will run the default target, which is "local".

The "local" build target will build the autocomplete component from its source files, but will NOT deploy the built files to the top level build folder.

The locally built files are stored in the temporary directory:

<project>/src/<component>/build_tmp

So, for autocomplete, the built files can be found in the directory below:

yui2/src/autocomplete/build_tmp

Build Output

ANT will output build information to the screen, as it runs through the build, which can be redirected to a file if required:

prompt> ant all

    Buildfile: build.xml
        [echo] Starting Build For autocomplete
        ...
        [echo]     builddir : ../../../builder/componentbuild
        ...
        ...
    BUILD SUCCESSFUL
    Total time: 7 seconds

prompt>

NOTE: Most components will have warnings which are output during the "minify" and "lint" steps, which the component developer has evaluated and determined to have no impact on functionality.

Creating Build Files For A New Component

The builder/componentbuild/templates directory has basic build.xml and build.properties templates for the various component types supported.

For most new components, you should be able to start with the appropriate template files and simply change the values of the basic properties defined to suit your component.

If you're creating:

  • A YUI 2 Component (either a JS or CSS component), use:

    builder/componentbuild/templates/yui2

     build.xml
     build.properties
    
  • A YUI 3 Component (either a JS or CSS component), use:

    builder/componentbuild/templates/yui3

     build.xml
     build.properties
    
  • A YUI 3 Rollup Component, use:

    builder/componentbuild/templates/yui3/rollup

    For the rollup component: build.xml build.properties

    For the sub components: subcomponentone.xml subcomponentone.properties subcomponenttwo.xml subcomponenttwo.properties

Further Customization

If required, you can define custom values for any of the properties defined in builder/componentbuild/docs/properties.html to customize the build for your new component, however as mentioned above, for most components the properties defined in the template files should be sufficient.

You can also override or extend existing targets, to customize the actual build process for a component if required. The list of targets and their role is defined in builder/componentbuild/docs/targets.html.

Log Verbosity

  • ant all will give you the default log output, may be a little noisy
  • ant all -v will give you full log output (really noisy)
  • ant all -q will give you only the jslint output from your build

JSLint/Hint

By default, we look for the node executable. If found we use a Node.js based JSLint server to lint the JS files. If it's not installed, we fall back to Rhino (which can be very slow)

If you install the jshint (npm -g i jshint), we will use that by default.

To skip using this you can pass -Djshint.skip=true:

`ant all -q -Djshint.skip=true`

The default is also to only run jslint/hint on RAW files, skipping min and debug versions.

You can change this by adding -Dlint.all=true to your command:

`ant all -q -Dlint.all=true`

More Repositories

1

yui3

A library for building richly interactive web applications.
JavaScript
4,118
star
2

yuicompressor

YUI Compressor
Java
3,010
star
3

yuidoc

YUI Javascript Documentation Tool
HTML
893
star
4

yeti

Yeti automates browser testing.
JavaScript
386
star
5

yui3-gallery

YUI3 Gallery Modules
JavaScript
333
star
6

yui2

YUI 2.x Source Tree
JavaScript
280
star
7

yuglify

UglifyJS Wrapper with YUI default configs
JavaScript
152
star
8

yuitest

YUI Test
Java
117
star
9

phploader

Server side PHP loader for YUI files
PHP
90
star
10

nodejs-yui3

Running YUI3 on NodeJS
JavaScript
85
star
11

shifter

New YUI build tool based on Gearjs, so let's shift some gears
JavaScript
75
star
12

gridbuilder

A little web app that generates responsive YUI Grids CSS
JavaScript
54
star
13

grover

YUITest wrapper for PhantomJS
JavaScript
45
star
14

yogi

Command Line Helper for YUI
JavaScript
31
star
15

skinbuilder

A tool for creating skins for YUI widgets
JavaScript
30
star
16

2in3

Repository for the 2in3 project source
JavaScript
20
star
17

yui-lint

Default JSlint rules used by YUI in it's various packages
14
star
18

editor-extras

A collection of text editor syntax files and other extras for working with YUI.
Vim Script
12
star
19

yui3-swfs

SWF-based functionality for https://github.com/yui/yui3.
ActionScript
7
star
20

grunt-yui-contrib

YUI Build Tasks
JavaScript
6
star
21

yui-assets

A simple place to locate YUI graphics assets for public use in talks, presentations or other media usage.
6
star
22

grifter

YUI module stealer/packager
JavaScript
4
star
23

yui.github.com

yui.github.com
2
star
24

Sights

A native Win8 app built using YUI3
JavaScript
1
star
25

metrotester

A native Windows 8 App that runs YUI unit tests.
JavaScript
1
star