Skip to content

Commit

Permalink
Merge pull request #18 from Thomas-Lebeau/bootstrap-3
Browse files Browse the repository at this point in the history
Add support for Bootstrap 3
  • Loading branch information
thomas-lebeau committed Aug 2, 2013
2 parents 2f595ee + 309c76a commit 879e651
Show file tree
Hide file tree
Showing 14 changed files with 111 additions and 108 deletions.
1 change: 0 additions & 1 deletion .jshintrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
{
"node": true,
"es5": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
Expand Down
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### 3.0.1 (02 August, 2013)

* Add support for Glyphicons
* Uptade to latest generator-webapp changes

### 3.0.0 (01 August, 2013)

* Update to Bootstrap 3

### 2.0.4 (01 August, 2013)

* Add support for coffeescript
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,6 @@
A Generator for Yeoman to work with the Less version of Twitter Bootstrap


## About
This generator has been redev from scratch to work with Yeoman 1.0
The improvments are:
- Much easier installation process. No needs to install dependencies manually anymore
- Better respect of Yeoman's workflow
- Possibility to include [Font Awesome](https://github.com/FortAwesome/Font-Awesome)


## Getting started
- Make sure you have [yo](https://github.com/yeoman/yo) installed:
`npm install -g yo`
Expand All @@ -21,13 +13,11 @@ The improvments are:

* `--skip-install`

Skips the automatic execution of `bower` and `npm` after
scaffolding has finished.
Skips the automatic execution of `bower` and `npm` after scaffolding has finished.

* `--test-framework=[framework]`
* `--test-framework <framework>`

Defaults to `mocha`. Can be switched for
another supported testing framework like `jasmine`.
Defaults to `mocha`. Can be switched for another supported testing framework like `jasmine`.


## License
Expand Down
2 changes: 1 addition & 1 deletion app/USAGE
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ Description:
Creates a new basic front-end web application with less version of Bootstrap.

Options:
Bootstrap Javascript files: Include the Bootstrap Javascript files
FontAwesome: Include the icon webfont FontAwesome
RequireJS: Add support for AMD-loading via RequireJS

Example:
yo bootstrap-less
Expand Down
97 changes: 49 additions & 48 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,38 +33,32 @@ BootstrapLessGenerator.prototype.askFor = function askFor() {
var cb = this.async();

// welcome message
var welcome =
'\n _-----_' +
'\n | |' +
'\n |' + '--(o)--'.red + '| .--------------------------.' +
'\n `---------´ | ' + 'Welcome to Yeoman,'.yellow.bold + ' |' +
'\n ' + '( '.yellow + '_' + '´U`'.yellow + '_' + ' )'.yellow + ' | ' + 'ladies and gentlemen!'.yellow.bold + ' |' +
'\n /___A___\\ \'__________________________\'' +
'\n | ~ |'.yellow +
'\n __' + '\'.___.\''.yellow + '__' +
'\n ´ ' + '` |'.red + '° ' + '´ Y'.red + ' `\n';

console.log(welcome);
console.log(this.yeoman);

var prompts = [{
name: 'fontawesome',
message: 'Would you like to use FontAwesome?',
default: 'Y/n',
warning: 'Yes: Enabling this will be totally awesome!'
}, {
name: 'jsBootstrap',
message: 'Would you like to use Bootstrap Javascript files?',
default: 'Y/n',
warning: 'Yes: Enabling this will be totally awesome!'
type: 'checkbox',
name: 'features',
message: 'What more would you like?',
choices: [{
name: 'Bootstrap Javascript files',
value: 'jsBootstrap',
checked: true
}, {
name: 'Bootstrap-Glyphicons',
value: 'glyphicons',
checked: true
}, {
name: 'FontAwesome',
value: 'fontawesome',
checked: false
}]
}];

this.prompt(prompts, function (err, props) {
if (err) {
return this.emit('error', err);
}

this.fontawesome = (/y/i).test(props.fontawesome);
this.jsBootstrap = (/y/i).test(props.jsBootstrap);
this.prompt(prompts, function (answers) {
var features = answers.features;
this.jsBootstrap = features.indexOf('jsBootstrap') !== -1;
this.glyphicons = features.indexOf('glyphicons') !== -1;
this.fontawesome = features.indexOf('fontawesome') !== -1;

cb();
}.bind(this));
Expand Down Expand Up @@ -104,14 +98,18 @@ BootstrapLessGenerator.prototype.h5bp = function h5bp() {
};

BootstrapLessGenerator.prototype.mainStylesheet = function mainStylesheet() {
var html = '@import "../bower_components/bootstrap/less/bootstrap.less";\n@import "../bower_components/bootstrap/less/responsive.less"; // Don\'t forget to comment lines 22 to remove the second import call to **mixin.less**\n\n';
var html = '@import "../bower_components/bootstrap/less/bootstrap.less";\n\n';

if (this.glyphicons) {
html = html + '@import "../bower_components/bootstrap-glyphicons/less/bootstrap-glyphicons.less";\n\n';
}

if (this.fontawesome) {
html = html + '@import "../bower_components/font-awesome/less/font-awesome.less";\n@FontAwesomePath: "../fonts";\n';
} else {
html = html + '@iconSpritePath: "../images/glyphicons-halflings.png";\n@iconWhiteSpritePath: "../images/glyphicons-halflings-white.png";\n\n';
html = html + '@import "../bower_components/font-awesome/less/font-awesome.less";\n@FontAwesomePath: "../fonts";\n\n';
}
html = html + '.hero-unit {\n margin: 50px auto 0 auto;\n}';

html = html + '.browsehappy {\n margin: 0.2em 0; \n background: #ccc; \n color: #000; \n padding: 0.2em 0; \n}\n\n';
html = html + '.jumbotron {\n margin: 50px auto 0 auto;\n}';
this.write('app/styles/main.less', html);
};

Expand All @@ -120,7 +118,7 @@ BootstrapLessGenerator.prototype.writeIndex = function writeIndex() {
var defaults = ['HTML5 Boilerplate', 'Twitter Bootstrap'];
var contentText = [
' <div class="container">',
' <div class="hero-unit">',
' <div class="jumbotron">',
' <h1>\'Allo, \'Allo!</h1>',
' <p>You now have</p>',
' <ul>'
Expand All @@ -136,24 +134,27 @@ BootstrapLessGenerator.prototype.writeIndex = function writeIndex() {
if (this.jsBootstrap) {
// wire Twitter Bootstrap plugins
this.indexFile = this.appendScripts(this.indexFile, 'scripts/vendor/bootstrap.js', [
'bower_components/bootstrap/js/bootstrap-affix.js',
'bower_components/bootstrap/js/bootstrap-alert.js',
'bower_components/bootstrap/js/bootstrap-dropdown.js',
'bower_components/bootstrap/js/bootstrap-tooltip.js',
'bower_components/bootstrap/js/bootstrap-modal.js',
'bower_components/bootstrap/js/bootstrap-transition.js',
'bower_components/bootstrap/js/bootstrap-button.js',
'bower_components/bootstrap/js/bootstrap-popover.js',
'bower_components/bootstrap/js/bootstrap-typeahead.js',
'bower_components/bootstrap/js/bootstrap-carousel.js',
'bower_components/bootstrap/js/bootstrap-scrollspy.js',
'bower_components/bootstrap/js/bootstrap-collapse.js',
'bower_components/bootstrap/js/bootstrap-tab.js'
'bower_components/bootstrap/js/affix.js',
'bower_components/bootstrap/js/alert.js',
'bower_components/bootstrap/js/dropdown.js',
'bower_components/bootstrap/js/tooltip.js',
'bower_components/bootstrap/js/modal.js',
'bower_components/bootstrap/js/transition.js',
'bower_components/bootstrap/js/button.js',
'bower_components/bootstrap/js/popover.js',
'bower_components/bootstrap/js/carousel.js',
'bower_components/bootstrap/js/scrollspy.js',
'bower_components/bootstrap/js/collapse.js',
'bower_components/bootstrap/js/tab.js'
]);
}

if (this.glyphicons) {
defaults.push('Bootstrap-Glyphicons <i class="glyphicon glyphicon-ok"></i>');
}

if (this.fontawesome) {
defaults.push('Font Awesome');
defaults.push('Font Awesome <i class="icon-flag"></i>');
}

this.mainJsFile = 'console.log(\'\\\'Allo \\\'Allo!\');';
Expand Down
15 changes: 9 additions & 6 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -241,22 +241,25 @@ module.exports = function (grunt) {
cwd: '<%%= yeoman.app %>',
dest: '<%%= yeoman.dist %>',
src: [
'*.{ico,txt}',<% if (fontawesome) { %>
'*.{ico,png,txt}',<% if (fontawesome) { %>
'fonts/*',<% } %>
'.htaccess',
'images/{,*/}*.{webp,gif}'
]
}]
},
server: {
files: [{
files: [{<% if (fontawesome) { %>
expand: true,
dot: true,<% if (fontawesome) { %>
dot: true,
cwd: '<%%= yeoman.app %>/bower_components/font-awesome/font/',
dest: '<%%= yeoman.app %>/fonts/',
src: ['*']<% } else { %>
cwd: '<%%= yeoman.app %>/bower_components/bootstrap/img/',
dest: '<%%= yeoman.app %>/images/',
src: ['*']<% } %>
}, {<% if (glyphicons) { %>
expand: true,
dot: true,
cwd: '<%%= yeoman.app %>/bower_components/bootstrap-glyphicons/fonts/',
dest: '<%%= yeoman.app %>/fonts/',
src: ['*']<% } %>
}]
}
Expand Down
7 changes: 4 additions & 3 deletions app/templates/_bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,10 @@
"name": "<%= _.slugify(appname) %>",
"version": "0.0.0",
"dependencies": {
"bootstrap": "~2.3.0",<% if (fontawesome) { %>
"font-awesome": "~3.0.2",<% } %>
"modernizr": "~2.6.2",
"bootstrap": "~3.0.0-rc1",<% if (fontawesome) { %>
"font-awesome": "~3.2.1",<% } %><% if (glyphicons) { %>
"bootstrap-glyphicons": "https://github.com/twbs/bootstrap-glyphicons.git#gh-pages",
"modernizr": "~2.6.2",<% } %>
"jquery": "~1.9.1"
},
"devDependencies": {}
Expand Down
32 changes: 16 additions & 16 deletions app/templates/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,26 +5,26 @@
"devDependencies": {
"grunt": "~0.4.1",
"grunt-contrib-copy": "~0.4.1",
"grunt-contrib-concat": "~0.1.3",
"grunt-contrib-coffee": "~0.6.5",
"grunt-contrib-uglify": "~0.2.0",
"grunt-contrib-jshint": "~0.4.1",
"grunt-contrib-cssmin": "~0.6.0",
"grunt-contrib-connect": "0.2.0",
"grunt-contrib-clean": "0.4.0",
"grunt-contrib-concat": "~0.3.0",
"grunt-contrib-coffee": "~0.7.0",
"grunt-contrib-uglify": "~0.2.2",
"grunt-contrib-jshint": "~0.6.2",
"grunt-contrib-cssmin": "~0.6.1",
"grunt-contrib-connect": "0.3.0",
"grunt-contrib-clean": "0.5.0",
"grunt-contrib-htmlmin": "0.1.3",
"grunt-contrib-imagemin": "0.1.3",
"grunt-contrib-imagemin": "0.1.4",
"grunt-contrib-livereload": "0.1.2",<% if (testFramework === 'jasmine') { %>
"grunt-contrib-jasmine": "~0.4.2",<% } %>
"grunt-contrib-jasmine": "~0.5.1",<% } %>
"grunt-rev": "~0.1.0",
"grunt-usemin": "~0.1.10",
"grunt-usemin": "~0.1.12",
"grunt-regarde": "~0.1.1",<% if (testFramework === 'mocha') { %>
"grunt-mocha": "~0.3.0",<% } %>
"grunt-open": "~0.2.0",
"grunt-svgmin": "0.1.0",
"grunt-recess": "~0.3.1",
"grunt-concurrent": "~0.1.0",
"matchdep": "~0.1.1"
"grunt-mocha": "~0.4.0",<% } %>
"grunt-open": "~0.2.1",
"grunt-svgmin": "0.2.0",
"grunt-recess": "~0.3.3",
"grunt-concurrent": "~0.3.0",
"matchdep": "~0.1.2"
},
"engines": {
"node": ">=0.8.0"
Expand Down
3 changes: 1 addition & 2 deletions app/templates/htaccess
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,9 @@

# Force the latest IE version, in various cases when it may fall back to IE7 mode
# github.com/rails/rails/commit/123eb25#commitcomment-118920
# Use ChromeFrame if it's installed for a better experience for the poor IE folk

<IfModule mod_headers.c>
Header set X-UA-Compatible "IE=Edge,chrome=1"
Header set X-UA-Compatible "IE=Edge"
# mod_headers can't match by content-type, but we don't want to send this header on *everything*...
<FilesMatch "\.(appcache|crx|css|eot|gif|htc|ico|jpe?g|js|m4a|m4v|manifest|mp4|oex|oga|ogg|ogv|otf|pdf|png|safariextz|svg|svgz|ttf|vcf|webm|webp|woff|xml|xpi)$">
Header unset X-UA-Compatible
Expand Down
17 changes: 9 additions & 8 deletions app/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
<!--[if gt IE 8]><!--> <html class="no-js"> <!--<![endif]-->
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->
<link rel="stylesheet" href="styles/main.css">
<!-- build:js scripts/vendor/modernizr.js -->
Expand All @@ -18,17 +18,18 @@
<body>

<!--[if lt IE 7]>
<p class="chromeframe">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> or <a href="http://www.google.com/chromeframe/?redirect=true">activate Google Chrome Frame</a> to improve your experience.</p>
<p class="browsehappy">You are using an <strong>outdated</strong> browser. Please <a href="http://browsehappy.com/">upgrade your browser</a> to improve your experience.</p>
<![endif]-->

<!-- Google Analytics: change UA-XXXXX-X to be your site's ID. -->
<script>
var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
g.src='//www.google-analytics.com/ga.js';
s.parentNode.insertBefore(g,s)}(document,'script'));
(function(b,o,i,l,e,r){b.GoogleAnalyticsObject=l;b[l]||(b[l]=
function(){(b[l].q=b[l].q||[]).push(arguments)});b[l].l=+new Date;
e=o.createElement(i);r=o.getElementsByTagName(i)[0];
e.src='//www.google-analytics.com/analytics.js';
r.parentNode.insertBefore(e,r)}(window,document,'script','ga'));
ga('create','UA-XXXXX-X');ga('send','pageview');
</script>


</body>
</html>
1 change: 0 additions & 1 deletion app/templates/jshintrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
{
"node": true,
"browser": true,
"es5": true,
"esnext": true,
"bitwise": true,
"camelcase": true,
Expand Down
2 changes: 1 addition & 1 deletion app/templates/robots.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# robotstxt.org
# robotstxt.org/

User-agent: *
14 changes: 8 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-bootstrap-less",
"version": "2.0.4",
"version": "3.0.1",
"description": "Yeoman generator fo twitter bootstrap less",
"keywords": [
"yeoman-generator",
Expand All @@ -9,13 +9,14 @@
"generator",
"bootsrap",
"twitter",
"font-awesome"
"font-awesome",
"glyphicons"
],
"homepage": "https://github.com/Thomas-Lebeau/generator-bootstrap-less",
"bugs": "https://github.com/Thomas-Lebeau/generator-bootstrap-less/issues",
"author": {
"name": "Thomas Lebeau",
"email": "thomas@elebeau.io",
"email": "thomas@lebeau.io",
"url": "http://lebeau.io"
},
"main": "app/index.js",
Expand All @@ -27,16 +28,17 @@
"test": "mocha"
},
"dependencies": {
"yeoman-generator": "~0.10.2"
"yeoman-generator": "~0.12.3"
},
"peerDependencies": {
"generator-mocha": "~0.1.1"
},
"devDependencies": {
"mocha": "~1.9.0"
"mocha": "~1.12.0"
},
"engines": {
"node": ">=0.8.0"
"node": ">=0.8.0",
"npm": ">=1.2.10"
},
"licenses": [
{
Expand Down
Loading

0 comments on commit 879e651

Please sign in to comment.