-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #35 from mrjoelkemp/no-cache
Fixes
- Loading branch information
Showing
26 changed files
with
104 additions
and
148 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,119 +1,85 @@ | ||
module.exports = function (grunt) { | ||
var path = require('path'), | ||
fs = require('fs'); | ||
var path = require('path'), | ||
fs = require('fs'); | ||
|
||
require('load-grunt-tasks')(grunt); | ||
require('load-grunt-tasks')(grunt); | ||
|
||
grunt.initConfig({ | ||
"sass": { | ||
"dist": { | ||
"files": [ | ||
{ | ||
"expand": true, | ||
"src": [ | ||
"**/*.{scss, sass}", | ||
"!node_modules/**/*.{scss, sass}" | ||
], | ||
"ext": ".css" | ||
} | ||
] | ||
} | ||
grunt.initConfig({ | ||
cacheBust: { | ||
options: { | ||
deleteOriginals: true | ||
}, | ||
"browserify": { | ||
"dist": { | ||
"files": { | ||
"dist/phpepl.js": ["src/phpepl.js"] | ||
assets: { | ||
files: [{ | ||
src: ['index.html'] | ||
}] | ||
} | ||
}, | ||
sass: { | ||
dist: { | ||
files: [ | ||
{ | ||
expand: true, | ||
src: [ | ||
"**/*.{scss, sass}", | ||
"!node_modules/**/*.{scss, sass}" | ||
], | ||
ext: ".css" | ||
} | ||
} | ||
] | ||
} | ||
}, | ||
browserify: { | ||
options: { | ||
exclude: [ | ||
'js/vendor/jquery-2.1.3.min.js', | ||
'js/vendor/moment.min.js' | ||
] | ||
}, | ||
"uglify": { | ||
"options": { | ||
"sourceMap": true, | ||
"sourceMapIncludeSources": true | ||
}, | ||
"dist": { | ||
"files": { | ||
"dist/phpepl.js": ['dist/phpepl.js'] | ||
} | ||
dist: { | ||
files: { | ||
"dist/phpepl.js": ["js/phpepl.js"] | ||
} | ||
} | ||
}, | ||
uglify: { | ||
options: { | ||
sourceMap: true, | ||
sourceMapIncludeSources: true | ||
}, | ||
"watch": { | ||
"sass": { | ||
"files": [ | ||
"**/*.scss", | ||
"!node_modules/**/*.scss", | ||
"!.git/**/*.scss", | ||
"!.sass-cache/**/*.scss", | ||
"!bower_components/**/*.scss", | ||
"!vendor/**/*.scss" | ||
], | ||
"tasks": [ | ||
"newer:sass" | ||
] | ||
}, | ||
"js": { | ||
"files": [ | ||
"src/**/*.js" | ||
], | ||
"tasks": [ | ||
"browserify", | ||
"uglify" | ||
] | ||
}, | ||
"all": { | ||
"files": [ | ||
"**/*", | ||
"!node_modules/**/*", | ||
"!.git/**/*", | ||
"!.sass-cache/**/*", | ||
"!bower_components/**/*", | ||
"!vendor/**/*" | ||
], | ||
"tasks": [ | ||
"noop" | ||
], | ||
"options": { | ||
"cwd": "./", | ||
"spawn": false, | ||
"event": [ | ||
"added" | ||
] | ||
} | ||
dist: { | ||
files: { | ||
"dist/phpepl.js": ['dist/phpepl.js'] | ||
} | ||
} | ||
}); | ||
|
||
grunt.registerTask('default', ['watch']); | ||
|
||
// Handle new files with that have a new, supported preprocessor | ||
grunt.event.on('watch', function(action, filepath) { | ||
var ext = path.extname(filepath); | ||
|
||
// Ignore directories | ||
if (fs.lstatSync(filepath).isDirectory()) return; | ||
|
||
if (action === 'added') { | ||
// This is a special message that's parsed by YA | ||
// to determine if support for an additional preprocessor is necessary | ||
// Note: this allows us to avoid controlling grunt manually within YA | ||
console.log('EXTADDED:' + ext); | ||
|
||
// Note: we don't do anything for newly added .js files | ||
// A new js file can't be the root unless it's changed to require | ||
// the current root and saved/changed | ||
} else if (action === 'changed' || action === 'deleted') { | ||
if (ext === '.js') { | ||
// Ignore bundles | ||
if (/.+bundle.js/g.test(filepath)) return; | ||
|
||
// Notify YA to recompute the roots and | ||
// generate a configuration | ||
console.log('JSCHANGED:' + filepath); | ||
} | ||
}, | ||
watch: { | ||
sass: { | ||
files: [ | ||
"**/*.scss", | ||
"!node_modules/**/*.scss", | ||
"!.git/**/*.scss", | ||
"!.sass-cache/**/*.scss", | ||
"!bower_components/**/*.scss", | ||
"!vendor/**/*.scss" | ||
], | ||
tasks: [ | ||
"newer:sass" | ||
] | ||
}, | ||
js: { | ||
files: [ | ||
"js/**/*.js", | ||
"!js/vendor/**/*.js" | ||
], | ||
tasks: [ | ||
"browserify", | ||
"uglify", | ||
'cacheBust' | ||
] | ||
} | ||
}); | ||
} | ||
}); | ||
|
||
// For watching entire directories but allowing | ||
// the grunt.event binding to take care of it | ||
grunt.registerTask('noop', function () {}); | ||
} | ||
grunt.registerTask('default', ['watch']); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters