Skip to content

Commit

Permalink
added compress rake task
Browse files Browse the repository at this point in the history
  • Loading branch information
Jiunn Haur Lim committed Jul 11, 2013
1 parent bf84975 commit 1af6f5e
Show file tree
Hide file tree
Showing 10 changed files with 68 additions and 95 deletions.
1 change: 1 addition & 0 deletions .ruby-version
@@ -0,0 +1 @@
2.0.0-p195
4 changes: 4 additions & 0 deletions Gemfile
@@ -0,0 +1,4 @@
source 'https://rubygems.org'

gem 'compass', '~> 0.12'
gem 'uglifier', '~> 2.1'
23 changes: 23 additions & 0 deletions Gemfile.lock
@@ -0,0 +1,23 @@
GEM
remote: https://rubygems.org/
specs:
chunky_png (1.2.8)
compass (0.12.2)
chunky_png (~> 1.2)
fssm (>= 0.2.7)
sass (~> 3.1)
execjs (1.4.0)
multi_json (~> 1.0)
fssm (0.2.10)
multi_json (1.7.7)
sass (3.2.9)
uglifier (2.1.1)
execjs (>= 0.3.0)
multi_json (~> 1.0, >= 1.0.2)

PLATFORMS
ruby

DEPENDENCIES
compass (~> 0.12)
uglifier (~> 2.1)
1 change: 0 additions & 1 deletion README.md
Expand Up @@ -34,7 +34,6 @@ $(function() {
});
```

- TODO compress
- TODO release plugin

## Configuration
Expand Down
18 changes: 18 additions & 0 deletions Rakefile
@@ -0,0 +1,18 @@
require 'uglifier'
require 'compass'

task :compile_js do
source = File.read(File.expand_path('js/box-lid.js', __dir__))
uglified, source_map = Uglifier.compile_with_map(source)
{ js: uglified, map: source_map }.each do |k, v|
File.write(File.expand_path("js/box-lid.min.#{k}", __dir__), v)
end
puts 'done with javascripts'
end

task :compile_css do
system 'compass compile', '--output-style=compressed', '.'
puts 'done with stylesheets'
end

task :compile => %i[compile_css compile_js]
87 changes: 1 addition & 86 deletions css/box-lid.css

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

2 changes: 2 additions & 0 deletions js/box-lid.js
Expand Up @@ -22,12 +22,14 @@

var container = $(opts.container);

// opens the lid with a tiny delay to prevent blinking
this.open = function() {
container.data('box-lid-timer', setTimeout(function() {
container.addClass(opts.flag);
}, 100));
};

// closes the lid
this.close = function() {
clearTimeout(container.data('box-lid-timer'));
container.removeClass(opts.flag);
Expand Down
11 changes: 11 additions & 0 deletions js/box-lid.min.js
@@ -0,0 +1,11 @@
/*!
* jQuery Box Lid Plugin v0.1
* https://github.com/jimjh/jquery-box-lid
*
* Copyright 2013 Jiunn Haur Lim
* Released under the MIT License
*
* Usage:
* $('.box-lid-menu').boxLid();
*/
!function(n){"use strict";function t(t){t=n.extend({container:".box-lid",flag:"box-lid-open"},t);var e=n(t.container);this.open=function(){e.data("box-lid-timer",setTimeout(function(){e.addClass(t.flag)},100))},this.close=function(){clearTimeout(e.data("box-lid-timer")),e.removeClass(t.flag)}}n.fn.boxLid=function(e){var i=new t(e);return this.each(function(){n(this).hover(i.open,i.close)})}}(jQuery);
1 change: 1 addition & 0 deletions js/box-lid.min.map

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

15 changes: 7 additions & 8 deletions sass/box-lid.scss
@@ -1,12 +1,11 @@
// TODO make mixins
// TODO compress
/*!
* jQuery Box Lid Plugin v0.1
* https://github.com/jimjh/jquery-box-lid
*
* Copyright 2013 Jiunn Haur Lim
* Released under the MIT License
*/
// TODO make mixins
@import "compass/css3";

$box-lid-background: #000 !default; // background that appears when lid is open
Expand All @@ -32,12 +31,12 @@ $box-lid-bar-background: rgba(0, 0, 0, 0.08) !default;

.box-lid-icon {
@include transition(all 250ms $box-lid-transition);
position: absolute;
position: absolute; // center the navicon
top: 50%;
left: 25%;
}

.box-lid-icon:before {
.box-lid-icon:before { // create the navicon using shadows
content: '';
position: absolute;
width: 1.1em;
Expand All @@ -50,13 +49,13 @@ $box-lid-bar-background: rgba(0, 0, 0, 0.08) !default;

.box-lid-menu {
width: $box-lid-bar-width;
position: fixed;
height: 100%;
background: $box-lid-bar-background;
position: fixed; // create bar that fills up the page
height: 100%;
top: 0;
left: 0;
z-index: 2;
nav {
nav { // push nav to the left, beyond the viewport
@include transition(all 500ms $box-lid-transition);
display: block;
height: 100%;
Expand All @@ -70,7 +69,7 @@ $box-lid-bar-background: rgba(0, 0, 0, 0.08) !default;
}

&.box-lid-open {
.box-lid-content {
.box-lid-content { // skew the content
@include transform(rotateY(-30deg) translateZ(0px) translateX(200px));
}
.box-lid-icon { @include opacity(0); }
Expand Down

0 comments on commit 1af6f5e

Please sign in to comment.