Permalink
Browse files

added add ons to grunt build

  • Loading branch information...
1 parent 3c1f3cd commit 404b57023bc2681d025f3944ed7b912e7d433e59 @aheinze aheinze committed Oct 9, 2013
Showing with 48 additions and 1 deletion.
  1. +39 −1 Gruntfile.js
  2. +1 −0 addons/src/form-icon/form-icon.less
  3. +1 −0 addons/src/form-password/form-password.less
  4. +7 −0 server.js
View
@@ -37,6 +37,8 @@ module.exports = function(grunt) {
}
};
+ //themes
+
["default", "custom"].forEach(function(f){
if(fs.existsSync('themes/'+f)) {
@@ -79,12 +81,31 @@ module.exports = function(grunt) {
}
});
+ //addons
+
+ fs.readdirSync('addons/src').forEach(function(f){
+
+ var addon = 'addons/src/'+f+'/'+f+'.less';
+
+ if(fs.existsSync(addon)) {
+
+ lessconf["addon-"+f] = {options: { paths: ['addons/src/'+f] }, files: {} };
+ lessconf["addon-"+f].files["dist/addons/css/"+f+".css"] = [addon];
+
+ lessconf["addon-"+f+"-min"] = {options: { paths: ['addons/src/'+f], yuicompress: true }, files: {} };
+ lessconf["addon-"+f+"-min" ].files["dist/addons/css/"+f+".min.css"] = [addon];
+ }
+ });
+
return lessconf;
})(),
copy: {
fonts: {
files: [{ expand: true, cwd: "src/fonts", src: ["*"], dest: "dist/fonts/" }]
+ },
+ addons: {
+ files: [{ expand: true, src: ["addons/src/**/*.js"], dest: "dist/addons/js", flatten: true }]
}
},
@@ -133,6 +154,23 @@ module.exports = function(grunt) {
files: {
"dist/js/uikit.min.js": ["dist/js/uikit.js"]
}
+ },
+ addonsmin: {
+ files: (function(){
+
+ var files = {};
+
+ fs.readdirSync('addons/src').forEach(function(f){
+
+ var addon = 'addons/src/'+f+'/'+f+'.js';
+
+ if(fs.existsSync(addon)) {
+ files['dist/addons/js/'+f+'.min.js'] = [addon];
+ }
+ });
+
+ return files;
+ })()
}
},
@@ -196,7 +234,7 @@ module.exports = function(grunt) {
grunt.loadNpmTasks("grunt-banner");
// Register grunt tasks
- grunt.registerTask("build", ["jshint", "indexthemes", "less", "concat", "uglify", "usebanner", "copy"]);
+ grunt.registerTask("build", ["jshint", "indexthemes", "less", "concat", "copy", "uglify", "usebanner"]);
grunt.registerTask("default", ["build", "compress"]);
};
@@ -8,6 +8,7 @@
*
========================================================================== */
+ @import "../../../src/less/variables.less";
/* Variables
========================================================================== */
@@ -8,6 +8,7 @@
*
========================================================================== */
+ @import "../../../src/less/variables.less";
/* Variables
========================================================================== */
View
@@ -42,6 +42,7 @@ http.createServer(function(request, response) {
var uri = url.parse(request.url).pathname, filename = path.join(process.cwd(), uri);
fs.exists(filename, function(exists) {
+
if(!exists) {
response.writeHead(404, {"Content-Type": "text/plain"});
response.end("404 Not Found");
@@ -50,6 +51,12 @@ http.createServer(function(request, response) {
if (fs.statSync(filename).isDirectory()) filename += '/index.html';
+ if(!fs.existsSync(filename)) {
+ response.writeHead(404, {"Content-Type": "text/plain"});
+ response.end("404 Not Found");
+ return;
+ }
+
fs.readFile(filename, "binary", function(err, file) {
if(err) {

0 comments on commit 404b570

Please sign in to comment.