Created
June 14, 2011 06:18
-
-
Save hitode909/1024417 to your computer and use it in GitHub Desktop.
HTMLとよく使うJSのテンプレート
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
create project foo | |
builder.rb foo | |
run server | |
python -m SimpleHTTPServer 3001 | |
setup | |
bundle install | |
run guard | |
bundle xec guard |
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
$ -> | |
alert 1 |
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
body { | |
color: red; | |
} |
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
#! /usr/bin/env ruby | |
require 'fileutils' | |
require 'erb' | |
include ERB::Util | |
def self_file | |
if File.symlink?(__FILE__) | |
require 'pathname' | |
Pathname.new(__FILE__).realpath | |
else | |
__FILE__ | |
end | |
end | |
def process_file(path) | |
ERB.new(open(path).read, nil, '-').result(binding) | |
end | |
$application_name = ARGV.shift | |
raise "USAGE: #{$0} $application_name" unless $application_name | |
Dir.mkdir $application_name | |
open(File.join($application_name, "index.html"), "w"){ |f| | |
f.write process_file(File.join(File.dirname(self_file), "index.erb")) | |
} | |
Dir.glob(File.dirname(self_file) + "/statics/*").each{ |file| | |
FileUtils.cp(file, File.join($application_name, File.basename(file))) | |
} | |
['less', 'coffee', ].each{ |type| | |
FileUtils.cp(File.join(File.dirname(self_file), "a.#{type}"), File.join($application_name, "#{$application_name}.#{type}")) | |
} | |
system "cat #{ File.dirname(self_file) }/README" |
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
source 'https://rubygems.org' | |
gem 'guard' | |
gem 'guard-less' | |
gem 'guard-coffeescript' | |
gem 'growl_notify' |
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
notification :growl | |
guard 'less', :all_on_start => true, :all_after_change => true do | |
watch(%r{^.+\.less$}) | |
end | |
guard 'coffeescript', :all_on_start => true do | |
watch(%r{^.+\.coffee$}) | |
end |
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
<!DOCTYPE html> | |
<html lang="ja"> | |
<head> | |
<meta charset="utf-8"> | |
<title><%=h $application_name %></title> | |
<script language="javascript" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> | |
<script language="javascript" type="text/javascript" src="//cdnjs.cloudflare.com/ajax/libs/underscore.js/1.6.0/underscore-min.js"></script> | |
<script language="javascript" type="text/javascript" src="<%=h $application_name %>.js"></script> | |
<link rel="stylesheet" type="text/css" href="<%=h $application_name %>.css" /> | |
</head> | |
<body> | |
<h1>It works!</h1> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment