Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/twbs/grunt-bootlint.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/tasks
diff options
context:
space:
mode:
authorZac Echola <zac.echola@gmail.com>2014-07-26 08:48:19 +0400
committerZac Echola <zac.echola@gmail.com>2014-07-26 08:48:19 +0400
commitf52415bdb2b1569bbfc5a09e1133d48a5cbd0c86 (patch)
tree22201d396add6b35c821b52c2cb9cceed2fa5c13 /tasks
:seedling:
Diffstat (limited to 'tasks')
-rw-r--r--tasks/bootlint.js50
1 files changed, 50 insertions, 0 deletions
diff --git a/tasks/bootlint.js b/tasks/bootlint.js
new file mode 100644
index 0000000..a8f00aa
--- /dev/null
+++ b/tasks/bootlint.js
@@ -0,0 +1,50 @@
+/*
+ * grunt-bootlint
+ * https://github.com/zacechola/grunt-bootlint
+ *
+ * Copyright (c) 2014 Zac Echola
+ * Licensed under the MIT license.
+ */
+
+'use strict';
+
+module.exports = function(grunt) {
+
+ // Please see the Grunt documentation for more information regarding task
+ // creation: http://gruntjs.com/creating-tasks
+
+ grunt.registerMultiTask('bootlint', 'An HTML linter for Bootstrap projects', function() {
+ // Merge task-specific and/or target-specific options with these defaults.
+ var options = this.options({
+ punctuation: '.',
+ separator: ', '
+ });
+
+ // Iterate over all specified file groups.
+ this.files.forEach(function(f) {
+ // Concat specified files.
+ var src = f.src.filter(function(filepath) {
+ // Warn on and remove invalid source files (if nonull was set).
+ if (!grunt.file.exists(filepath)) {
+ grunt.log.warn('Source file "' + filepath + '" not found.');
+ return false;
+ } else {
+ return true;
+ }
+ }).map(function(filepath) {
+ // Read file source.
+ return grunt.file.read(filepath);
+ }).join(grunt.util.normalizelf(options.separator));
+
+ // Handle options.
+ src += options.punctuation;
+
+ // Write the destination file.
+ grunt.file.write(f.dest, src);
+
+ // Print a success message.
+ grunt.log.writeln('File "' + f.dest + '" created.');
+ });
+ });
+
+};