Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sass #32

Open
wants to merge 3 commits into
base: v3.2
Choose a base branch
from
Open

Sass #32

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
node_modules/
temp/
.DS_Store
.DS_Store

# webstorm files
.idea
14 changes: 14 additions & 0 deletions .idea/codeStyleSettings.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ Importantly, grunt-dom-munger uses CSS attribute selectors to manage the parsing

Release History
-------------
* 6/10/2014 - v3.1.1 - Fix for backslashes being used in injected routes/tags on subgenerators.
* 5/1/2014 - v3.1.0 - New subgenerators for modules and modals. Replaced grunt-contrib-jasmine with grunt-karma. Karma allows us to test against actual browsers other than PhantomJS.
* 3/10/2014 - v3.0.2 - Fix for directive files not being named correctly. Fix for htmlmin from affecting some Bootstrap styles.
* 3/03/2014 - v3.0.0 - All subgenerators now ask the user for a directory enabling any user-defined project structure. Gruntfile has been altered to allow scripts, partials, and LESS files to be located anywhere in the project directory structure. An option to use `angular-ui-router` is now available when initializing a new project. `js/setup.js` and `css/app.less` moved to `app.js` and `app.less`. `grunt server` is now `grunt serve`. Inside `index.html` all user script tags are grouped together instead of split out into groups for services/filters/etc. New ability to customize the subgenerators.
Expand Down
23 changes: 19 additions & 4 deletions app/templates/Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ module.exports = function (grunt) {
livereloadOnError: false,
spawn: false
},
files: [createFolderGlobs(['*.js','*.less','*.html']),'!_SpecRunner.html','!.grunt'],
files: [createFolderGlobs(['*.js','*.less','*.s?ss','*.html']),'!_SpecRunner.html','!.grunt'],
tasks: [] //all the tasks are run dynamically during the watch event handler
}
},
Expand All @@ -70,7 +70,17 @@ module.exports = function (grunt) {
after: {
src:['temp']
}
},
},<% if (css == 'Sass') { %>
sass: {
production: {
options: {
sourceComments: "map"
},
files: {
'temp/app.css': 'app.scss'
}
}
},<% } else { %>
less: {
production: {
options: {
Expand All @@ -79,7 +89,7 @@ module.exports = function (grunt) {
'temp/app.css': 'app.less'
}
}
},
},<% } %>
ngtemplates: {
main: {
options: {
Expand Down Expand Up @@ -194,7 +204,7 @@ module.exports = function (grunt) {
}
});

grunt.registerTask('build',['jshint','clean:before','less','dom_munger','ngtemplates','cssmin','concat','ngmin','uglify','copy','htmlmin','imagemin','clean:after']);
grunt.registerTask('build',['jshint','clean:before','<%= _.slugify(css) %>','dom_munger','ngtemplates','cssmin','concat','ngmin','uglify','copy','htmlmin','imagemin','clean:after']);
grunt.registerTask('serve', ['dom_munger:read','jshint','connect', 'watch']);
grunt.registerTask('test',['dom_munger:read','karma:all_tests']);

Expand Down Expand Up @@ -225,6 +235,11 @@ module.exports = function (grunt) {
}
}

//if scss/sass file changed, we need to recompile for dev
if (filepath.lastIndexOf('.sass') !== -1 || filepath.lastIndexOf('.scss') !== -1) {
tasksToRun.push('sass');
}

//if index.html changed, we need to reread the <script> tags so our next run of karma
//will have the correct environment
if (filepath === 'index.html') {
Expand Down
Empty file added modal/templates/modal.scss
Empty file.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "generator-cg-angular",
"version": "3.1.0",
"version": "3.1.1",
"description": "Yeoman Generator for Enterprise Angular projects.",
"keywords": [
"yeoman-generator",
Expand Down
3 changes: 3 additions & 0 deletions utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ exports.inject = function(filename,that,module) {
configFile = path.join(path.dirname(module.file),configFile);
injectFileRef = path.relative(path.dirname(module.file),filename);
}
injectFileRef = injectFileRef.replace(/\\/g,'/');
var lineTemplate = _.template(config.template)({filename:injectFileRef});
exports.addToFile(configFile,lineTemplate,config.marker);
that.log.writeln(chalk.green(' updating') + ' %s',path.basename(configFile));
Expand All @@ -107,6 +108,8 @@ exports.inject = function(filename,that,module) {

exports.injectRoute = function(moduleFile,uirouter,name,route,routeUrl,that){

routeUrl = routeUrl.replace(/\\/g,'/');

if (uirouter){
var code = '$stateProvider.state(\''+name+'\', {\n url: \''+route+'\',\n templateUrl: \''+routeUrl+'\'\n });';
exports.addToFile(moduleFile,code,exports.STATE_MARKER);
Expand Down