All Projects → bevry-archive → Buildr

bevry-archive / Buildr

Licence: mit
The (Java|Coffee)Script and (CSS|Less) (Builder|Bundler|Packer|Minifier|Merger|Checker)

Programming Languages

coffeescript
4710 projects

Projects that are alternatives of or similar to Buildr

Walk
A fast, general purpose, graph based build and task execution utility.
Stars: ✭ 108 (-48.82%)
Mutual labels:  build-system
Arduino Cmake Ng
CMake-Based framework for Arduino platforms
Stars: ✭ 123 (-41.71%)
Mutual labels:  build-system
Build
B2 makes it easy to build C++ projects, everywhere.
Stars: ✭ 182 (-13.74%)
Mutual labels:  build-system
Pants
The Pantsbuild developer workflow system
Stars: ✭ 1,814 (+759.72%)
Mutual labels:  build-system
Please
High-performance extensible build system for reproducible multi-language builds.
Stars: ✭ 1,856 (+779.62%)
Mutual labels:  build-system
Blt
A streamlined CMake build system foundation for developing HPC software
Stars: ✭ 135 (-36.02%)
Mutual labels:  build-system
Corrosion
Marrying Rust and CMake - Easy Rust and C/C++ Integration!
Stars: ✭ 106 (-49.76%)
Mutual labels:  build-system
Dds
A C++ tool for a new decade
Stars: ✭ 194 (-8.06%)
Mutual labels:  build-system
Mmake
Mmake is a small program which wraps make to provide additional functionality, such as user-friendly help output, remote includes, and eventually more. It otherwise acts as a pass-through to standard make.
Stars: ✭ 1,593 (+654.98%)
Mutual labels:  build-system
Bear
Bear is a tool that generates a compilation database for clang tooling.
Stars: ✭ 2,345 (+1011.37%)
Mutual labels:  build-system
Mill
Your shiny new Java/Scala build tool!
Stars: ✭ 1,667 (+690.05%)
Mutual labels:  build-system
Blade Build
Blade is a powerful build system from Tencent, supports many mainstream programming languages, such as C/C++, java, scala, python, protobuf...
Stars: ✭ 1,722 (+716.11%)
Mutual labels:  build-system
Reggae
Build system in D, Python, Ruby, Javascript or Lua
Stars: ✭ 141 (-33.18%)
Mutual labels:  build-system
Ocamlverse.github.io
Documentation of everything relevant in the OCaml world
Stars: ✭ 117 (-44.55%)
Mutual labels:  build-system
Fpm
Fortran Package Manager (fpm)
Stars: ✭ 184 (-12.8%)
Mutual labels:  build-system
Meteor
Meteor, the JavaScript App Platform
Stars: ✭ 42,739 (+20155.45%)
Mutual labels:  build-system
Style Dictionary
A build system for creating cross-platform styles.
Stars: ✭ 2,097 (+893.84%)
Mutual labels:  build-system
Rules haskell
Haskell rules for Bazel.
Stars: ✭ 196 (-7.11%)
Mutual labels:  build-system
Earthly
Repeatable builds
Stars: ✭ 5,805 (+2651.18%)
Mutual labels:  build-system
Mingw Builds
Scripts for building the dual-target(32 & 64 bit) MinGW-W64 compilers for 32 and 64 bit Windows
Stars: ✭ 145 (-31.28%)
Mutual labels:  build-system

Welcome to Buildr

The (Java|Coffee)Script and (CSS|Less) (Builder|Bundler|Packer|Minifier|Merger|Checker)

Install

  1. Install Node.js

  2. Install dependencies for image compression

    • On OSX

        ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"
        brew install gifsicle libjpeg optipng pngcrush
      
    • On Apt Linux

        sudo apt-get update && sudo apt-get install gifsicle libjpeg-progs optipng pngcrush
      
    • On Yum Linux

        sudo yum -y install gifsicle libjpeg-progs optipng pngcrush
      
    • Windows

      Hahahahaha

Configure

Before you use Buildr, you must specify some configuration for it. The available configuration is:

{
	# Options
	name: null # (name to be outputted in log messages) String or null
	log: true # (log status updates to console?) true or false
	watch: false # (automatically rebuild on file change?) true or false

	# Handlers
	buildHandler: false # (fired when build completed) function or false
	rebuildHandler: false # (fired when rebuild completed) function or false
	successHandler: false # (fired when (re)build completed successfully) function or false

	# Paths
	srcPath: false # String
	outPath: false # String or false

	# Checking
	checkScripts: true # Array or true or false
	checkStyles: true # Array or true or false
	jshintOptions: false # Object or false
	csslintOptions: false # Object or false

	# Compression (requires outPath)
	compressScripts: true # Array or true or false
	compressStyles: true # Array or true or false
	compressImages: true # Array or true or false

	# Order
	scriptsOrder: false # Array or false
	stylesOrder: false # Array or false

	# Bundling (requires Order)
	bundleScriptPath: false # String or false
	bundleStylePath: false # String or false
	deleteBundledFiles: true # (requires outPath) true or false 

	# Loaders (requires Order)
	srcLoaderHeader: false # String or false
	srcLoaderPath: false # String or false
}

The above values are the default values for those options. The settings which are set to true will auto-detect the files for you.

Options

There are currently two options available, the log and watch options.

  • The log option when enabled will output all status messages, by default this is enabled.
  • The watch option when enabled will allow buildr to run in the background watching for changes in our srcPath, if a change is detected then our project is automatically rebuilt for us, by default this is disabled.

Handlers

There are two handlers you can configure, they are the buildHandler and the rebuildHandler.

  • The buildHandler is fired after our project has been built.
  • The rebuildHandler is fired after our project has been rebuilt. Our project is rebuilt when we utilise the watch: true config option, which scans for changes in the background and automatically rebuilds our project on change. If this isn't specified, then the buildHandler will automatically be used as the rebuildHandler.

They are both passed a single argument called err which is either an Error instance, or false if no error occurred. They both also have default values, so you don't need to specify them if you don't want to.

Checking

To pass your scripts through jshint and your styles through csslint, you'd want the following configuration:

{
	# Paths
	srcPath: 'src' # String

	# Checking
	checkScripts: true # Array or true or false
	checkStyles: true # Array or true or false
	jshintOptions: false # Object or false
	csslintOptions: false # Object or false
}

Compression

To copy your src directory to an out directory, then compile and compress all your styles and scripts in the out directory, you'd want the following configuration:

{
	# Paths
	srcPath: 'src' # String
	outPath: 'out' # String or false

	# Compression (without outPath only the generated bundle files are compressed)
	compressScripts: true # Array or true or false
	compressStyles: true # Array or true or false
	compressImages: true # Array or true or false
}

If your outPath is the same as your srcPath then the only files which will be compressed are the generated bundle files.

Bundling

To bundle all your style files into one file called out/bundled.css and all your script files into one file called out/bundled.js, you'd want the following configuration:

{
	# Paths
	srcPath: 'src' # String
	outPath: 'out' # String or false

	# Order
	scriptsOrder: [
		'script1.js'
		'script2.coffee'
	] # Array or false
	stylesOrder: [
		'style1.css'
		'style2.less'
	] # Array or false

	# Bundling (requires Order)
	bundleScriptPath: false # String or false
	bundleStylePath: false # String or false
	deleteBundledFiles: true # (requires outPath) true or false 
}

Loaders

To generate a source loader file called src/loader.js which will load in all your source styles and scripts into the page, you can use the following:

{
	# Paths
	srcPath: 'src' # String

	# Order
	scriptsOrder: [
		'script1.js'
		'script2.coffee'
	] # Array or false
	stylesOrder: [
		'style1.css'
		'style2.less'
	] # Array or false

	# Loaders (requires Order)
	srcLoaderHeader: '''
		# Prepare
		myprojectEl = document.getElementById('myproject-include')
		myprojectBaseUrl = myprojectEl.src.replace(/\\?.*$/,'').replace(/loader\\.js$/, '').replace(/\\/+$/, '')+'/'

		# Load in with Buildr
		myprojectBuildr = new window.Buildr {
			baseUrl: myprojectBaseUrl
			beforeEl: myprojectEl
			serverCompilation: window.serverCompilation or false
			scripts: scripts
			styles: styles
		}
		myprojectBuildr.load()
		''' # note, all \ in this are escaped due to it being in a string
	srcLoaderPath: 'src/myproject.loader.js' # String or false
}

Then include into your page with the following html:

<script id="myproject-include" src="../../loader.js"></script>

This is incredibly useful for developing apps which have lots of files, as instead of updating all your demo page's html with the new script and style files all the time, you just include the loader.

Combining

You can feel free to combine any of the configurations above to get something which checks, compiles, compresses, bundles, and generates loaders too. Though compression and bundling is dependent on having an outPath which is different from your srcPath.

Run

As a Command Line Tool

Within your application folder

  1. Install Buildr Globally

     npm -g install buildr
    
  2. Stick your configuration in buildr.cson

  3. Run the global buildr

     buildr
    

You may specify the filename for configuring by passing -f or --file on the command-line.

As a Module

Within your application folder

  1. Install Buildr Locally

     npm install buildr
    
  2. Code buildr.coffee

    buildr = require 'buildr'
    config = {} # your configuration
    myBuildr = buildr.createInstance(config)
    myBuildr.process (err) ->
    	throw err if err
    	console.log 'Building completed'
    
  3. Run your buildr file

     coffee buildr.coffee
    

License

Licensed under the MIT License Copyright 2011 Benjamin Arthur Lupton

History

Changelog

  • v0.8.7 March 24, 2013

    • Fix issue 34
    • Fix syntax error in CLI script which prevents error reporting.
    • Copy source files recursively again (reverting v0.8.5 fix) which is safe because we switched to rimraf (to fix issue 34).
  • v0.8.6 March 17, 2013

    • Replace deprecated path.exists call with fs.exists.
    • Fix build issue with Cakefile.
    • Fix issue 32 and 33
  • v0.8.5 November 11, 2012

    • Fix problem with copying of hidden directories like .svn/
  • v0.8.4 November 5, 2012

    • Fix bug 31: Log level debug is always used, regardless of configuration.
  • v0.8.3 October 28, 2012

    • Feature request #13: specify .cson file at command line
    • Feature request #15: Macro preprocessor
    • Fix bugs 8, 19, 20, 21, 23, 25, 27, 28, 30
    • Use cake to build JavaScript, making buildr easier to run
    • Updated dependencies to fix several bugs
  • v0.8 September 27, 2011

    • Fixed concurrency support
    • Fixed compression under certain configurations
    • Added Caterpillar for awesome console logging
  • v0.7 August 22, 2011

    • Added watch, buildHandler and rebuildHandler options
  • v0.6 July 21, 2011

    • v0.6.0 July 21, 2011
      • Added javascript, image and css compression
      • Added jshint and csslint checks
    • v0.6.6 August 16, 2011
      • Fixed relative paths between outPath and bundledPaths
  • v0.5 July 9, 2011

    • Added srcLoader compilation
  • v0.4 July 1, 2011

    • Extremely Simplified
    • Only supports bundling of js|coffee and css|less files currently
  • v0.3 May 31, 2011

    • Exploration into better architectures
  • v0.2 April 2, 2011

    • Initial Release
  • v0.1 March 23, 2011

    • Initial Commit

Todo

  • Needs auto file finding for bundling/orders
  • Needs no-config version
  • Needs unit tests
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].