Skip to content

Commit

Permalink
feat(app generator): reorganize sass tree structure and @imports
Browse files Browse the repository at this point in the history
  • Loading branch information
cueedee committed Aug 26, 2016
1 parent 7771b14 commit 267a5af
Show file tree
Hide file tree
Showing 8 changed files with 128 additions and 18 deletions.
10 changes: 9 additions & 1 deletion generators/app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,9 @@ var AppGenerator = generators.Base.extend(
// Style and Compass:

, 'src/sass'
, 'src/sass/overrides'
, 'src/sass/settings'
, 'src/sass/views'

, 'src/style'
, 'src/style/images/'
Expand Down Expand Up @@ -385,9 +388,14 @@ var AppGenerator = generators.Base.extend(

// Style and Compass:

, [ 'src/sass/app.sass' ]
, 'src/sass/settings/_compass.sass'
, 'src/sass/settings/_fonts.sass'
, 'src/sass/settings/_icons.scss'
, 'src/sass/settings/_layout.sass'
, 'src/sass/_overrides.sass'
, 'src/sass/_settings.sass'
, 'src/sass/_views.sass'
, [ 'src/sass/app.sass' ]
, 'src/style/images/sprites/check-green.png'
]
;
Expand Down
7 changes: 7 additions & 0 deletions generators/app/templates/src/sass/_overrides.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
//
// Define only CSS overrides here.
//
// Variable definitions are best done in a corresponding 'settings/*' section.
//
// @import "overrides/..."
52 changes: 37 additions & 15 deletions generators/app/templates/src/sass/_settings.sass
Original file line number Diff line number Diff line change
@@ -1,22 +1,44 @@
// All variables and loading of mixins should be done here

//
// Define only variables and mixins here.
//
// Variable definitions are best done in a corresponding 'settings/*' section.
//
//
// Compass's mixins and variables definitions.
//
@import "settings/_compass"

// Load default compass mixins

//
// Font definitions.
//
@import "compass/utilities/general/clearfix"
@import "compass/utilities/general/hacks"
@import "compass/css3"
@import "compass/css3/box-shadow"
@import "compass/css3/user-interface"
// Setup the automatic spriting
@import "settings/_fonts"


//
// Icon definitions.
//
// Want to use a sprite?
// Step 1: Add the image to the sprites folder
// Step 2: Use example: "background: sprite( $sprites-sprite, name-of-file-without-extension ) no-repeat"
// Step 3: Sit back and relax, when compass compiles it generates the sprite for you and
// does the heavy lifting for you....
@import "settings/_icons"


//
// App variables definitions.
//
@import "settings/_layout"

// ... add more as needed...
//
// Framework variable defaults.
//
// For instance:
//
$sprites-path: "images/sprites/"
$sprites-sprite: sprite-map( "sprites/*.png" )
// @import "settings/_bootstrap"
26 changes: 24 additions & 2 deletions generators/app/templates/src/sass/app.sass
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
.<%- packageName %>

@import _settings
//
// App variables definitions.
// Fonts definitions.
// Compass's mixins and variables definitions.
// Defaults for framework variables.
//
@import "_settings"

//
// Frameworks.
//
// For instance:
//
// @import "bootstrap/_bootstrap"
//
// CSS overrides.
//
@import "_overrides"

//
// App views' CSS.
// Every view should have it's own style file in the `views` folder and be `@import`-ed in '_views.sass'.
//
@import _views
@import "_views"

//
// Only really global styling should be here.
Expand Down
21 changes: 21 additions & 0 deletions generators/app/templates/src/sass/settings/_compass.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@

//
// Compass mixins.
//
@import "compass/utilities/general/clearfix"
@import "compass/utilities/general/hacks"
@import "compass/css3"
@import "compass/css3/box-shadow"
@import "compass/css3/user-interface"

// Setup the automatic spriting
//
// Want to use a sprite?
// Step 1: Add the image to the sprites folder
// Step 2: Use example: "background: sprite( $sprites-sprite, name-of-file-without-extension ) no-repeat"
// Step 3: Sit back and relax, when compass compiles it generates the sprite for you and
// does the heavy lifting for you....
//
$sprites-path: "images/sprites/"
$sprites-sprite: sprite-map( "sprites/*.png" )
8 changes: 8 additions & 0 deletions generators/app/templates/src/sass/settings/_fonts.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@

// For instance:
//
// Comfortaa
//
// http://webfonts.ffonts.net/Comfortaa.font
//
// +font-face( 'Comfortaa', font-files('comfortaa/comfortaa.ttf.woff','comfortaa/comfortaa.ttf.svg'), 'comfortaa/comfortaa.ttf.eot', 'normal', 'normal' )
18 changes: 18 additions & 0 deletions generators/app/templates/src/sass/settings/_icons.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

//
// Perhaps create your own icon font at:
//
// http://fontastic.me/
//

//
// Include the generated font, say, `my-icons` like so:
//
// @at-root {
// @include font-face( 'my-icons', font-files('my-icons/my-icons.woff','my-icons/my-icons.ttf','my-icons/my-icons.svg'), 'my-icons/my-icons.eot', 'normal', 'normal' );
// }
//

//
// Include the css mappings to the font's 'characters here.
//
4 changes: 4 additions & 0 deletions generators/app/templates/src/sass/settings/_layout.sass
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

//
// Global layout dependent settings (dimensions, positioning, etc) can go here.
//

0 comments on commit 267a5af

Please sign in to comment.