NAME
WWW::Bootstrap - fetch, build and use the Bootstrap CSS Framework
SYNOPSIS
use WWW::Bootstrap;
my $bootstrap = WWW::Bootstrap->(workdir => '/tmp');
# set a few variables
$bootstrap->set_variable(body-bg => '#fefefe');
$bootstrap->set_variable(font-base-size => '15px');
# fetch the bootstrap archive from github
$bootstrap->fetch_and_extract();
# OR use a local copy of the github archive
$bootstrap->fetch_and_extract('/tmp/bootstrap.zip');
# update the *.less files
$bootstrap->update_less();
# generate the css and js files
$bootstrap->build();
# copy the files to your document root
$bootstrap->copy_to('/var/www/htdocs/');
DESCRIPTION
WWW::Bootstrap wrapps downloading, editing less files and generating css files for the Bootstrap framework
METHODS
- new(%args)
-
Create a new Bootstrap Instance. Valid arguments are:
- workdir => $path
-
Path to the working directory to use.
Defaults to /tmp/bootstrap
- dl_url => $url
-
URL to download bootstrap source archive.
Defaults to https://github.com/twbs/bootstrap/archive/master.zip
- disabled_features => [ $feature1, $feature2, ... ]
-
List of features to disable during build-time.
See also: "disable_feature($feature)"
- variables => { $var1 => $val1, $var2 => $val2 }
-
Hash refernce of variables to be overwritten in varaibles.less
See also: "set_variable($var => $val)"
- disable_feature($feature)
-
Disable a feature during buildtime by disabling the matching lessfile.
$feature
must be the namepart of a file in less/, for example"scaffolding"
for less/scaffolding.less:$bootstrap->disable_feature("scaffolding");
- set_variable($var => $val)
-
Set the value of a variable in variables.less.
$var
must be the variable name without leading @.$boostrap->set_value(body-bg => '#fefefe');
For a full list of variables, have a look at http://getbootstrap.com/customize/#less-variables.
- fetch_and_extract($zipfile)
-
Fetch and extract the bootstrap sourcecode from github. If the optional parameter
$zipfile
is given, it will be used as path to a local copy of the ZIP file, instead of fetching it via HTTP. - update_less()
-
Updates the less/*.less files to reflect the currently disabled features and the updated variables.
- build()
-
Generates the CSS and JS files. After the process is done, the new files are located in the bootstrap-master/dist folder in the working directory.
- copy_to($target_dir|@path_elements)
-
Copies the current content of the dist/ folder to the
$target_dir
. If@path_elements
, the elements will be used to construct the target path with "catfile" in File::Spec. The target directory will be created if it does not already exist.
CAVEATS
The build process requires node.js to be installed to generate the CSS and JS files.
AUTHOR
LICENSE
This library is free software; you may redistribute it and/or modify it under the same terms as Perl itself.