]> khamidou — GitHub mirrors - snippets.git/commitdiff
added code for Rake and Sass
authorkarim hamidou <khamidou@gmail.com>
Thu, 9 Feb 2012 19:24:22 +0000 (20:24 +0100)
committerkarim hamidou <khamidou@gmail.com>
Thu, 9 Feb 2012 19:24:22 +0000 (20:24 +0100)
README
Rake/Rakefile_concat_js [new file with mode: 0644]
Sass/960.scss [new file with mode: 0644]

diff --git a/README b/README
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..23749f8bf87fcdce529f876cdd633bd74aed4775 100644 (file)
--- a/README
+++ b/README
@@ -0,0 +1,2 @@
+This repository holds snippets of code I reuse from project to project.
+All the code is under (old-style) BSD license.
diff --git a/Rake/Rakefile_concat_js b/Rake/Rakefile_concat_js
new file mode 100644 (file)
index 0000000..9d36371
--- /dev/null
@@ -0,0 +1,46 @@
+require 'rake'
+
+task :default => :compile_templates
+
+task :clean_compiled_files do
+    if File.exist?('release.js')
+        File.unlink('release.js')
+    end
+    
+    if File.exist?('style.css')
+        File.unlink('style.css')
+    end
+
+end
+
+task :compile_sass => :clean_compiled_files do
+    system("sass css/style.scss ./style.css")
+    puts "compiled stylesheets"
+end
+
+task :compile_js => :clean_compiled_files do
+    out = ""
+    Dir['js/*'].sort.each do |file|
+        out += File.read(file)
+    end
+
+    File.open("release.js", 'a') { |file|
+        file.write(out)
+    }
+    puts "done concatenating files"
+end
+
+task :compile_templates => [:compile_js, :compile_sass] do
+    templates = ""
+    Dir['templates/*'].each do |file|
+        templates += "Minitape." + File.basename(file).split(".")[0] + "_template = \"" + File.read(file).gsub("\n", "") + "\";"
+    end
+    
+    File.open("release.js", 'a') { |file|
+        file.write(templates)
+    }
+
+    puts "done compiling templates"
+end
+
+
diff --git a/Sass/960.scss b/Sass/960.scss
new file mode 100644 (file)
index 0000000..7cd7522
--- /dev/null
@@ -0,0 +1,37 @@
+$column_width: 60px;
+$column_num: 12;
+$gutter_width: 20px;
+
+@mixin grid($n) {
+  display: inline;
+  float: left;
+  position: relative;
+  margin-left: $gutter_width / 2;
+  margin-right: $gutter_width / 2;
+  width: ($column_width + $gutter_width) * $n - $gutter_width;
+}
+
+@mixin push($n) {
+  position: relative;
+  left: ($column_width + $gutter_width) * $n;
+}
+
+@mixin pull($n) {
+  left: -($column_width + $gutter_width) * $n;
+}
+
+@mixin prefix($n) {
+  padding-left: ($column_width + $gutter_width) * $n;
+}
+
+@mixin suffix($n) {
+  padding-right: ($column_width + $gutter_width) * $n;
+}
+
+@mixin alpha {
+  margin-left: 0;
+}
+
+@mixin omega {
+  margin-right: 0;
+}