New Download page for compass docs
This commit is contained in:
parent
5bc36855bc
commit
cb7ac80330
79
doc-src/assets/javascripts/download.js
Normal file
79
doc-src/assets/javascripts/download.js
Normal file
@ -0,0 +1,79 @@
|
||||
function showInstallCommand() {
|
||||
var cmd = $("#existence").val();
|
||||
var commands = [];
|
||||
var notes = [];
|
||||
var project_name = "<myproject>";
|
||||
var can_be_bare = true;
|
||||
commands.push("$ gem install compass");
|
||||
if (cmd == "init") {
|
||||
commands.push("$ cd " + project_name);
|
||||
project_name = ".";
|
||||
}
|
||||
if ($("#app-type").val() == "rails") {
|
||||
if (cmd == "create") {
|
||||
commands.push("$ rails new " + project_name);
|
||||
}
|
||||
cmd = "init rails";
|
||||
can_be_bare = false;
|
||||
} else if ($("#app-type").val() == "other") {
|
||||
if (cmd == "init") {
|
||||
cmd = "create";
|
||||
}
|
||||
} else if ($("#app-type").val() == "stand-alone") {
|
||||
if (cmd == "init") {
|
||||
cmd = "install";
|
||||
can_be_bare = false;
|
||||
}
|
||||
}
|
||||
var framework = $("#framework").val();
|
||||
var create_command;
|
||||
if (cmd == "install") {
|
||||
create_command = "$ compass install " + framework + " " + project_name;
|
||||
} else {
|
||||
create_command = "$ compass " + cmd + " " + project_name;
|
||||
}
|
||||
if (framework != "compass" && framework != "bare" && cmd != "install") {
|
||||
create_command = create_command + " --using " + framework;
|
||||
} else if (framework == "bare") {
|
||||
if (can_be_bare) {
|
||||
create_command = create_command + " --bare";
|
||||
} else {
|
||||
notes.push("<p class='note warning'>You cannot create a bare project in this configuration. Feel free to remove any stylesheets that you don't want.</p>");
|
||||
}
|
||||
}
|
||||
if ($("#syntax").val() == "sass") {
|
||||
create_command = create_command + " --syntax sass";
|
||||
}
|
||||
if ($("#options").val() == "customized") {
|
||||
create_command = create_command + " --sass-dir <sassdir> --css-dir <cssdir> --javascripts-dir <jsdir> --images-dir <imgsdir>";
|
||||
}
|
||||
commands.push(create_command);
|
||||
var instructions = "<pre><code>" + commands.join("\n") + "</code></pre>";
|
||||
if (instructions.match(/</)) {
|
||||
notes.push("<p class='note'>Note: Values indicated by <> are placeholders. Change them to suit your needs.</em>");
|
||||
}
|
||||
$("#steps").html(instructions + notes.join(""));
|
||||
}
|
||||
|
||||
function attachMadlibBehaviors() {
|
||||
$("#app-type").change(function(event) {
|
||||
var val = $(event.target).val();
|
||||
if (val == "other") {
|
||||
$("#options").val("customized");
|
||||
$(".madlib").addClass("customizable");
|
||||
} else if (val == "rails") {
|
||||
$("#options").val("default");
|
||||
$(".madlib").removeClass("customizable");
|
||||
} else {
|
||||
$(".madlib").addClass("customizable");
|
||||
}
|
||||
});
|
||||
$("#existence, #app-type, #framework, #syntax, #options").change(showInstallCommand);
|
||||
}
|
||||
|
||||
function setupMadlib() {
|
||||
attachMadlibBehaviors();
|
||||
showInstallCommand();
|
||||
}
|
||||
|
||||
$(setupMadlib);
|
48
doc-src/content/download.haml
Normal file
48
doc-src/content/download.haml
Normal file
@ -0,0 +1,48 @@
|
||||
---
|
||||
title: Download | Compass Documentation
|
||||
crumb: Download
|
||||
body_id: download
|
||||
---
|
||||
- content_for :javascripts do
|
||||
%script(src="/javascripts/download.js")
|
||||
%p
|
||||
Compass runs on any computer that has
|
||||
<a href="http://www.ruby-lang.org/en/downloads/">ruby installed</a>.
|
||||
|
||||
%h2 Tell us about your project and we'll help you get it set up:
|
||||
%blockquote.madlib.customizable<
|
||||
I would like to set up my
|
||||
%select#existence
|
||||
%option{:value => "create"} new
|
||||
%option{:value => "init"} existing
|
||||
%select#app-type
|
||||
%option{:value => "stand-alone"} compass
|
||||
%option{:value => "rails"} rails
|
||||
%option{:value => "other"} other
|
||||
project
|
||||
with
|
||||
%select#framework
|
||||
%option{:value => "compass"} compass's
|
||||
%option{:value => "blueprint"} blueprint's
|
||||
%option{:value => "bare"} no
|
||||
starter stylesheets.
|
||||
%br
|
||||
I prefer the
|
||||
%select#syntax
|
||||
%option{:value => "scss"} CSS based (SCSS)
|
||||
%option{:value => "sass"} Indent based (Sass)
|
||||
syntax<span class="customization">
|
||||
= succeed "." do
|
||||
and would like to
|
||||
%select#options
|
||||
%option{:value => "default"} use compass's recommended
|
||||
%option{:value => "customized"} customize my project's
|
||||
directory structure</span>
|
||||
%h4 Thanks. Now run the following steps in your terminal:
|
||||
#steps
|
||||
Loading...
|
||||
%p.note Note: <code>$</code> is a placeholder for your terminal's prompt. You don't type it.
|
||||
%h4 Then follow the instructions that compass provides in the output.
|
||||
|
||||
%h2 Or you can buy a <a href="http://compass.handlino.com/">GUI for Compass</a> from Handlino.
|
||||
|
8
doc-src/content/stylesheets/partials/_download.scss
Normal file
8
doc-src/content/stylesheets/partials/_download.scss
Normal file
@ -0,0 +1,8 @@
|
||||
body#download {
|
||||
#steps, p.madlib, p.note, h4 { margin-top: 1em; }
|
||||
p.note { font-size: smaller; font-style: italic; }
|
||||
p.warning { color: #c00; }
|
||||
.customization { display: none; }
|
||||
.customizable .customization { display: inline; }
|
||||
blockquote { border-left: 2px solid #ccc; text-indent: 0; padding-left: 0.5em; }
|
||||
}
|
@ -16,6 +16,7 @@
|
||||
@import "partials/main";
|
||||
@import "partials/code";
|
||||
@import "partials/example";
|
||||
@import "partials/download";
|
||||
|
||||
@import "syntax/syntax-theme";
|
||||
|
||||
|
@ -9,6 +9,8 @@
|
||||
%li
|
||||
%a{:href => "/reference/compass/", :rel => "documentation"} Reference
|
||||
%li
|
||||
%a{:href => "/help", :rel=> "help"} Help
|
||||
%a{:href => "/help/", :rel=> "help"} Help
|
||||
%li
|
||||
%a{:href => "/get-involved", :rel=> "get-involved"} Get Involved
|
||||
%a{:href => "/get-involved/", :rel=> "get-involved"} Get Involved
|
||||
%li
|
||||
%a{:href => "/download/", :rel=> "download"} Download
|
||||
|
@ -132,3 +132,7 @@ def compass_version
|
||||
"#{v[:major]}.#{v[:minor]}#{"."+v[:state] if v[:state]}.#{v[:build]}"
|
||||
end
|
||||
|
||||
def long_compass_version
|
||||
require 'compass/commands'
|
||||
Compass::Commands::PrintVersion.long_output_string
|
||||
end
|
@ -54,6 +54,15 @@ Options:
|
||||
parser.parse!
|
||||
parser.options
|
||||
end
|
||||
def long_output_string
|
||||
lines = []
|
||||
lines << "Compass #{::Compass.version[:string]}"
|
||||
lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
|
||||
lines << "Released under the MIT License."
|
||||
lines << "Compass is charityware."
|
||||
lines << "Please make a tax deductable donation for a worthy cause: http://umdf.org/compass"
|
||||
lines.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
attr_accessor :options
|
||||
@ -79,13 +88,7 @@ Options:
|
||||
elsif options[:quiet]
|
||||
puts ::Compass.version[:string]
|
||||
else
|
||||
lines = []
|
||||
lines << "Compass #{::Compass.version[:string]}"
|
||||
lines << "Copyright (c) 2008-#{Time.now.year} Chris Eppstein"
|
||||
lines << "Released under the MIT License."
|
||||
lines << "Compass is charityware."
|
||||
lines << "Please make a tax deductable donation: http://umdf.org/compass"
|
||||
puts lines.join("\n")
|
||||
puts self.class.long_output_string
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user