Skip to content

Commit

Permalink
restructuring to work better with Git
Browse files Browse the repository at this point in the history
  • Loading branch information
alexkingorg committed Feb 3, 2012
1 parent d942564 commit 40a0a83
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 15 deletions.
14 changes: 9 additions & 5 deletions build/README.markdown → README.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,15 @@
Each site's configuration will likely be a little different. I've found it useful to structure assets like this:

assets/
config.php # Includes Builder.php. Defines the bundles.
load.php # Includes config.php. Handles enqueueing assets/bundles into WordPress.
build/
config.php
load.php
asset-build/ # This repo
config-example.php # Includes Builder.php. Defines the bundles.
load-example.php # Includes config.php. Handles enqueueing assets/bundles into WordPress.
build.php # Includes config.php. The command-line build script.
Bundler.php # This class keeps track of all the assets, bundles, and has a method to write files.
lib/
Bundler.php # This class keeps track of all the assets, bundles, and has a method to write files.
Bundler_Loader.php

Setting up bundles is easy using the `define_bundle()` and `add_to_bundle()` methods. For example:

Expand All @@ -46,7 +50,7 @@ then...

$ php build.php

By default, build.php will look for your config file at `./config.php`. You can specify a path to your config file like this, though:
By default, build.php will look for your config file at `../config.php`. You can specify a path to your config file like this, though:

$ php build.php --config=../path/to/config.php

Expand Down
4 changes: 3 additions & 1 deletion build/build.php → build.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ function process_args($argv){

/* Get the path to the config file.
The config file is required to include the Bundler class */
$config_path = 'config.php';
if (isset($args['config'])) {
$config_path = $args['config'];
}
else {
$config_path = '../config.php';
}
require_once($config_path);

if (!class_exists('Bundler')) {
Expand Down
7 changes: 2 additions & 5 deletions config.php → config-example.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?php
// Navigate to asset root using realpath.
$abspath = realpath(realpath(dirname(__FILE__)) . '/../');
require_once($abspath . '/asset-builder/lib/Bundler.php');

require_once('./asset-build/lib/Bundler.php');

$bundler = Bundler::create($abspath);

Expand All @@ -25,5 +24,3 @@
$bundler->push($bundle_js);

/* END EXAMPLE */

?>
5 changes: 1 addition & 4 deletions load.php → load-example.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,7 @@
// Using icky blog global to determine which assets to deliver for now.
global $blog;

cfct_template_file('asset-builder', 'config');

cfct_template_file('assets', 'config');

if (!is_admin()) {
$asset_url = trailingslashit(get_bloginfo('template_url'));
Expand Down Expand Up @@ -48,5 +47,3 @@ function enqueue_bundle($language, $key, $path, $dependencies, $version) {
break;
}
}

?>

0 comments on commit 40a0a83

Please sign in to comment.