Skip to content
This repository has been archived by the owner on Feb 12, 2022. It is now read-only.

Extending FuelUX While Using FuelCDN

Steven Rogers edited this page Sep 24, 2013 · 3 revisions

Problem: "I want to use the FuelCDN version of FuelUX. But if I come across a bug that interferes with my project, I have to retain my own copy of FuelUX or wait for the bug fix to trickle down to the FuelCDN version. Not to mention if I want to add functionality…​"

Solution: Extend FuelUX after it’s loaded:

define(['fuelux'], function () {
	'use strict';

	var $ = require('jquery');

	// change something with the data grid control
	$.fn.extend($.fn.datagrid.Constructor.prototype, {
		// adding methods
		newMethod: function () { },

		// overriding methods
		someExistingMethod: function () { }
	});

	// rinse and repeat
});

Now one can benefit from bug fixes, new functionality, and still use FuelCDN.

When new versions hit FuelCDN: If the remote method contains the bugfix AND new functionality, the local version still replaces it ensuring one’s app (at least in this method) acts as expected until the new FuelUX version can be fully tested. Otherwise, since the two methods are now identical, the developer can remove the local version at their leisure.