Skip to content

Commit

Permalink
fix(sass): Ensure CSS or SCSS files are properly created. Change wire…
Browse files Browse the repository at this point in the history
…dep config. Closes #99
  • Loading branch information
diegonetto committed Sep 7, 2014
1 parent 380d9a6 commit b2cb5cf
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 26 deletions.
21 changes: 13 additions & 8 deletions app/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -135,16 +135,21 @@ IonicGenerator.prototype.createIndexHtml = function createIndexHtml() {
this.write(path.join(this.appPath, 'index.html'), this.indexFile);
};

IonicGenerator.prototype.copyStyles = function copyStyles() {
var sass = this.compass;
var mainFile = 'main.' + (sass ? 'sass' : 'css');

IonicGenerator.prototype.ensureStyles = function ensureStyles() {
// Only create a main style file if the starter template didn't
// have any styles. In the case it does, the starter should
// supply both main.css and main.sass files.
if (_.isEmpty(this.expand('app/styles/main.*'))) {
this.copy('styles/' + mainFile, 'app/styles/' + mainFile);
}
// supply both main.css and main.scss files, one of which
// will be deleted
var done = this.async();
var unusedFile = 'main.' + (this.compass ? 'css' : 'scss');
fs.unlink(path.resolve('app/styles', unusedFile), function (err) {
if (_.isEmpty(this.expand('app/styles/main.*'))) {
var cssFile = 'main.' + (this.compass ? 'scss' : 'css');
this.copy('styles/' + cssFile, 'app/styles/' + cssFile);
}
done();
}.bind(this));

};

IonicGenerator.prototype.packageFiles = function packageFiles() {
Expand Down
3 changes: 0 additions & 3 deletions templates/common/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,6 @@ module.exports = function (grunt) {

// Automatically inject Bower components into the app
wiredep: {
options: {
cwd: '<%%= yeoman.app %>'
},
app: {
src: ['<%%= yeoman.app %>/index.html'],
ignorePath: /\.\.\//
Expand Down
9 changes: 1 addition & 8 deletions templates/styles/main.css
Original file line number Diff line number Diff line change
@@ -1,8 +1 @@
/* Your app's CSS, go crazy, make it your own */

.ionic-logo {
display: block;
margin: 15px auto;
width: 96px;
height: 96px;
}
/* Your application styles go here */
7 changes: 0 additions & 7 deletions templates/styles/main.sass

This file was deleted.

1 change: 1 addition & 0 deletions templates/styles/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
// Your application styles go here

0 comments on commit b2cb5cf

Please sign in to comment.