Skip to content

Commit

Permalink
Merge pull request #596 from eleven-labs/fix-reuse-mixins-styles
Browse files Browse the repository at this point in the history
Merge styles index and vendor in one file
  • Loading branch information
Swiip committed Jun 18, 2015
2 parents dc56479 + d7efe8d commit 5ce1bc6
Show file tree
Hide file tree
Showing 30 changed files with 116 additions and 216 deletions.
33 changes: 1 addition & 32 deletions app/src/ui.js
Expand Up @@ -2,29 +2,6 @@

module.exports = function(GulpAngularGenerator) {

/**
* There is 2 ways of dealing with vendor styles
* - If the vendor styles exist in the css preprocessor chosen,
* the best is to include directly the source files
* - If not, the vendor styles are simply added as standard css links
*
* isVendorStylesPreprocessed defines which solution has to be used
* regarding the ui framework and the css preprocessor chosen
*/
GulpAngularGenerator.prototype.vendorStyles = function vendorStyles() {
this.isVendorStylesPreprocessed = false;

if(this.props.cssPreprocessor.extension === 'scss') {
if(this.props.ui.key === 'bootstrap' || this.props.ui.key === 'foundation') {
this.isVendorStylesPreprocessed = true;
}
} else if(this.props.cssPreprocessor.extension === 'less') {
if(this.props.ui.key === 'bootstrap') {
this.isVendorStylesPreprocessed = true;
}
}
};

/**
* Add files of the navbar and the main view depending on the ui framework
* and the css preprocessor
Expand All @@ -47,7 +24,7 @@ module.exports = function(GulpAngularGenerator) {
this.files.push({
src: 'src/app/_' + this.props.ui.key + '/__' + this.props.ui.key + '-index.' + this.props.cssPreprocessor.extension,
dest: 'src/app/index.' + this.props.cssPreprocessor.extension,
template: false
template: true
});

this.files.push({
Expand All @@ -61,14 +38,6 @@ module.exports = function(GulpAngularGenerator) {
dest: 'src/app/components/navbar/navbar.' + this.props.cssPreprocessor.extension,
template: false
});

if(this.props.cssPreprocessor.key !== 'none') {
this.files.push({
src: 'src/app/_' + this.props.ui.key + '/__' + this.props.ui.key + '-vendor.' + this.props.cssPreprocessor.extension,
dest: 'src/app/vendor.' + this.props.cssPreprocessor.extension,
template: true
});
}
};

/**
Expand Down
12 changes: 2 additions & 10 deletions app/templates/gulp/_styles.js
Expand Up @@ -27,8 +27,7 @@ gulp.task('styles', function () {

var injectFiles = gulp.src([
path.join(conf.paths.src, '/app/**/*.<%- props.cssPreprocessor.extension %>'),
path.join('!' + conf.paths.src, '/app/index.<%- props.cssPreprocessor.extension %>'),
path.join('!' + conf.paths.src, '/app/vendor.<%- props.cssPreprocessor.extension %>')
path.join('!' + conf.paths.src, '/app/index.<%- props.cssPreprocessor.extension %>')
], { read: false });

var injectOptions = {
Expand All @@ -41,22 +40,15 @@ gulp.task('styles', function () {
addRootSlash: false
};

var indexFilter = $.filter('index.<%- props.cssPreprocessor.extension %>');
var vendorFilter = $.filter('vendor.<%- props.cssPreprocessor.extension %>');
<% if (props.cssPreprocessor.key === 'ruby-sass') { -%>
var cssFilter = $.filter('**/*.css');
<% } -%>

return gulp.src([
path.join(conf.paths.src, '/app/index.<%- props.cssPreprocessor.extension %>'),
path.join(conf.paths.src, '/app/vendor.<%- props.cssPreprocessor.extension %>')
path.join(conf.paths.src, '/app/index.<%- props.cssPreprocessor.extension %>')
])
.pipe(indexFilter)
.pipe($.inject(injectFiles, injectOptions))
.pipe(indexFilter.restore())
.pipe(vendorFilter)
.pipe(wiredep(_.extend({}, conf.wiredep)))
.pipe(vendorFilter.restore())
<% if (props.cssPreprocessor.key === 'ruby-sass') { -%>
.pipe($.rubySass(sassOptions)).on('error', conf.errorHandler('RubySass'))
.pipe(cssFilter)
Expand Down
3 changes: 0 additions & 3 deletions app/templates/src/_index.html
Expand Up @@ -8,9 +8,6 @@
<!-- Place favicon.ico and apple-touch-icon.png in the root directory -->

<!-- build:css({<%- props.paths.tmp %>/serve,<%- props.paths.src %>}) styles/vendor.css -->
<% if (props.cssPreprocessor.key !== 'none') { -%>
<link rel="stylesheet" href="app/vendor.css">
<% } -%>
<!-- bower:css -->
<!-- run `gulp inject` to automatically populate bower styles dependencies -->
<!-- endbower -->
Expand Down
@@ -1,3 +1,10 @@
/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* less dependencies when defined in the bower.json of your dependencies
*/
// bower:less
// endbower

@import url(//fonts.googleapis.com/css?family=Roboto+Slab:400,700|Roboto:400,700,700italic,400italic);

html {
Expand Down
@@ -1,4 +1,11 @@
@import url(//fonts.googleapis.com/css?family=Roboto+Slab:400,700|Roboto:400,700,700italic,400italic);
/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* sass dependencies when defined in the bower.json of your dependencies
*/
// bower:scss
// endbower

@import url(http://fonts.googleapis.com/css?family=Roboto+Slab:400,700|Roboto:400,700,700italic,400italic);

html {
font-family: 'Roboto Slab', serif;
Expand Down
@@ -1,3 +1,10 @@
/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* stylus dependencies when defined in the bower.json of your dependencies
*/
// bower:styl
// endbower

@import url("//fonts.googleapis.com/css?family=Roboto\+Slab:400,700|Roboto:400,700,700italic,400italic")

html
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

14 changes: 14 additions & 0 deletions app/templates/src/app/_bootstrap/__bootstrap-index.less
@@ -1,3 +1,17 @@
/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* less dependencies when defined in the bower.json of your dependencies
*/
// bower:less
// endbower

/**
* If you want to override some bootstrap variables, you have to change values here.
* The list of variables are listed here bower_components/bootstrap/less/variables.less
*/
@navbar-inverse-link-color: #5AADBB;
@icon-font-path: '../<%- computedPaths.appToBower %>/bower_components/bootstrap/fonts/';

.browsehappy {
margin: 0.2em 0;
background: #ccc;
Expand Down
14 changes: 14 additions & 0 deletions app/templates/src/app/_bootstrap/__bootstrap-index.scss
@@ -1,3 +1,17 @@
/**
* If you want to override some bootstrap variables, you have to change values here.
* The list of variables are listed here bower_components/bootstrap-sass-official/assets/stylesheets/bootstrap/_variables.scss
*/
$navbar-inverse-link-color: #5AADBB;
$icon-font-path: "../<%- computedPaths.appToBower %>/bower_components/bootstrap-sass-official/assets/fonts/bootstrap/";

/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* sass dependencies when defined in the bower.json of your dependencies
*/
// bower:scss
// endbower

.browsehappy {
margin: 0.2em 0;
background: #ccc;
Expand Down
14 changes: 14 additions & 0 deletions app/templates/src/app/_bootstrap/__bootstrap-index.styl
@@ -1,3 +1,17 @@
/**
* If you want to override some bootstrap variables, you have to change values here.
* The list of variables are listed here bower_components/bootstrap-stylus/bootstrap/variables.styl
*/
$navbar-inverse-link-color = #5AADBB
$icon-font-path = "../<%- computedPaths.appToBower %>/bower_components/bootstrap-stylus/fonts/"

/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* stylus dependencies when defined in the bower.json of your dependencies
*/
// bower:styl
// endbower

.browsehappy
margin 0.2em 0
background #ccc
Expand Down
13 changes: 0 additions & 13 deletions app/templates/src/app/_bootstrap/__bootstrap-vendor.less

This file was deleted.

13 changes: 0 additions & 13 deletions app/templates/src/app/_bootstrap/__bootstrap-vendor.scss

This file was deleted.

13 changes: 0 additions & 13 deletions app/templates/src/app/_bootstrap/__bootstrap-vendor.styl

This file was deleted.

7 changes: 7 additions & 0 deletions app/templates/src/app/_foundation/__foundation-index.less
@@ -1,3 +1,10 @@
/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* less dependencies when defined in the bower.json of your dependencies
*/
// bower:less
// endbower

.browsehappy {
margin: 0.2em 0;
background: #ccc;
Expand Down
19 changes: 19 additions & 0 deletions app/templates/src/app/_foundation/__foundation-index.scss
@@ -1,3 +1,22 @@
/**
* If you want to override some foundation settings, you have to change values here.
* The list of settings values are listed here bower_components/foundation/scss/foundation/_settings.scss
*/
$topbar-bg-color: #5AADBB;

/**
* The import of foundation is made manually because there is still no links of the
* sass version in their bower.json...
*/
@import '../<%- computedPaths.appToBower %>/bower_components/foundation/scss/foundation';

/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* sass dependencies when defined in the bower.json of your dependencies
*/
// bower:scss
// endbower

.browsehappy {
margin: 0.2em 0;
background: #ccc;
Expand Down
7 changes: 7 additions & 0 deletions app/templates/src/app/_foundation/__foundation-index.styl
@@ -1,3 +1,10 @@
/**
* Do not remove this comments bellow. It's the markers used by wiredep to inject
* stylus dependencies when defined in the bower.json of your dependencies
*/
// bower:styl
// endbower

.browsehappy
margin 0.2em 0
background #ccc
Expand Down
6 changes: 0 additions & 6 deletions app/templates/src/app/_foundation/__foundation-vendor.less

This file was deleted.

18 changes: 0 additions & 18 deletions app/templates/src/app/_foundation/__foundation-vendor.scss

This file was deleted.

6 changes: 0 additions & 6 deletions app/templates/src/app/_foundation/__foundation-vendor.styl

This file was deleted.

5 changes: 5 additions & 0 deletions app/templates/src/app/_none/__none-index.less
@@ -1,3 +1,8 @@
/* Do not remove this comments bellow. It's the markers used by wiredep to inject
less dependencies when defined in the bower.json of your dependencies */
// bower:less
// endbower

.browsehappy {
margin: 0.2em 0;
background: #ccc;
Expand Down
5 changes: 5 additions & 0 deletions app/templates/src/app/_none/__none-index.scss
@@ -1,3 +1,8 @@
/* Do not remove this comments bellow. It's the markers used by wiredep to inject
sass dependencies when defined in the bower.json of your dependencies */
// bower:scss
// endbower

.browsehappy {
margin: 0.2em 0;
background: #ccc;
Expand Down
5 changes: 5 additions & 0 deletions app/templates/src/app/_none/__none-index.styl
@@ -1,3 +1,8 @@
/* Do not remove this comments bellow. It's the markers used by wiredep to inject
stylus dependencies when defined in the bower.json of your dependencies */
// bower:styl
// endbower

.browsehappy
margin 0.2em 0
background #ccc
Expand Down
4 changes: 0 additions & 4 deletions app/templates/src/app/_none/__none-vendor.less

This file was deleted.

4 changes: 0 additions & 4 deletions app/templates/src/app/_none/__none-vendor.scss

This file was deleted.

4 changes: 0 additions & 4 deletions app/templates/src/app/_none/__none-vendor.styl

This file was deleted.

0 comments on commit 5ce1bc6

Please sign in to comment.