├── test └── unit │ └── Stor.service.spec.js ├── .bowerrc ├── views ├── partials │ └── templates.jade ├── templates │ └── drawer.jade ├── 404.jade └── layout.jade ├── cm ├── .travis.yml ├── .gitignore ├── doc │ ├── baboon.png │ ├── reporting.html │ ├── docs.css │ └── upgrade_v2.2.html ├── .gitattributes ├── theme │ ├── ambiance-mobile.css │ ├── neat.css │ ├── elegant.css │ ├── cobalt.css │ ├── eclipse.css │ ├── night.css │ ├── monokai.css │ ├── erlang-dark.css │ ├── blackboard.css │ ├── rubyblue.css │ ├── vibrant-ink.css │ ├── twilight.css │ ├── lesser-dark.css │ └── xq-dark.css ├── test │ ├── mode_test.css │ ├── run.js │ ├── phantom_driver.js │ └── lint │ │ └── lint.js ├── README.md ├── package.json ├── demo │ ├── resize.html │ ├── matchhighlighter.html │ ├── loadmode.html │ ├── closetag.html │ ├── changemode.html │ ├── variableheight.html │ ├── visibletabs.html │ ├── marker.html │ ├── multiplex.html │ ├── mustache.html │ ├── emacs.html │ ├── runmode.html │ ├── vim.html │ ├── preview.html │ ├── xmlcomplete.html │ ├── complete.html │ ├── folding.html │ ├── formatting.html │ ├── widget.html │ ├── theme.html │ ├── activeline.html │ ├── btree.html │ ├── search.html │ └── collapserange.html ├── LICENSE ├── keymap │ └── emacs.js ├── bin │ └── compress └── CONTRIBUTING.md ├── art └── options-btn.tif ├── public ├── images │ ├── favicon.ico │ ├── loading.gif │ ├── options-btn.png │ ├── glyphicons-halflings.png │ └── glyphicons-halflings-white.png ├── stylesheets │ ├── style.less │ ├── bootstrap │ │ ├── layouts.less │ │ ├── component-animations.less │ │ ├── utilities.less │ │ ├── grid.less │ │ ├── breadcrumbs.less │ │ ├── responsive-768px-979px.less │ │ ├── hero-unit.less │ │ ├── wells.less │ │ ├── responsive-1200px-min.less │ │ ├── close.less │ │ ├── accordion.less │ │ ├── pager.less │ │ ├── media.less │ │ ├── scaffolding.less │ │ ├── responsive.less │ │ ├── thumbnails.less │ │ ├── code.less │ │ ├── alerts.less │ │ ├── bootstrap.less │ │ ├── responsive-utilities.less │ │ ├── tooltip.less │ │ ├── labels-badges.less │ │ ├── modals.less │ │ ├── pagination.less │ │ ├── carousel.less │ │ ├── progress-bars.less │ │ └── popovers.less │ └── app │ │ ├── navbar.less │ │ └── gh.less └── javascripts │ ├── src │ ├── lodash-extenders.js │ ├── Less2Css │ │ ├── controllers │ │ │ ├── AppCtrl.js │ │ │ ├── Less2CssCtrl.js │ │ │ └── OptionsCtrl.js │ │ ├── less2css.js │ │ ├── directives │ │ │ ├── drawer.js │ │ │ └── lessEditor.js │ │ └── services │ │ │ ├── LessLoader.js │ │ │ ├── LessOptions.js │ │ │ └── LessCompiler.js │ ├── Stor │ │ └── angular-stor.js │ └── base-extenders.js │ └── vendor │ └── cm │ └── addon │ ├── fold │ ├── foldcode.js │ └── brace-fold.js │ └── edit │ ├── closebrackets.js │ └── matchbrackets.js ├── .gitmodules ├── .tern-project ├── bower.json ├── express ├── versions.js ├── shortener.js ├── less-express-compiler.js ├── app-scripts.js ├── karma.e2e.conf.js ├── less-options.js └── karma.conf.js ├── todo.todo ├── routes └── index.js ├── .jshintrc ├── less-preview.sublime-project ├── package.json ├── changelog.md ├── .gitignore ├── app.js ├── Readme.md └── Gruntfile.js /test/unit/Stor.service.spec.js: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "public/components" 3 | } -------------------------------------------------------------------------------- /views/partials/templates.jade: -------------------------------------------------------------------------------- 1 | include ../templates/drawer -------------------------------------------------------------------------------- /cm/.travis.yml: -------------------------------------------------------------------------------- 1 | language: node_js 2 | node_js: 3 | - 0.8 4 | -------------------------------------------------------------------------------- /cm/.gitignore: -------------------------------------------------------------------------------- 1 | /node_modules 2 | /npm-debug.log 3 | test.html 4 | -------------------------------------------------------------------------------- /cm/doc/baboon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/cm/doc/baboon.png -------------------------------------------------------------------------------- /art/options-btn.tif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/art/options-btn.tif -------------------------------------------------------------------------------- /public/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/favicon.ico -------------------------------------------------------------------------------- /public/images/loading.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/loading.gif -------------------------------------------------------------------------------- /public/images/options-btn.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/options-btn.png -------------------------------------------------------------------------------- /public/images/glyphicons-halflings.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/glyphicons-halflings.png -------------------------------------------------------------------------------- /public/images/glyphicons-halflings-white.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bfricka/less-preview/HEAD/public/images/glyphicons-halflings-white.png -------------------------------------------------------------------------------- /cm/.gitattributes: -------------------------------------------------------------------------------- 1 | *.txt text 2 | *.js text 3 | *.html text 4 | *.md text 5 | *.json text 6 | *.yml text 7 | *.css text 8 | *.svg text 9 | -------------------------------------------------------------------------------- /cm/theme/ambiance-mobile.css: -------------------------------------------------------------------------------- 1 | .cm-s-ambiance.CodeMirror { 2 | -webkit-box-shadow: none; 3 | -moz-box-shadow: none; 4 | -o-box-shadow: none; 5 | box-shadow: none; 6 | } 7 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "less"] 2 | path = less 3 | url = https://github.com/less/less.js 4 | [submodule "CodeMirror"] 5 | path = CodeMirror 6 | url = https://github.com/marijnh/CodeMirror.git 7 | -------------------------------------------------------------------------------- /.tern-project: -------------------------------------------------------------------------------- 1 | { 2 | "libs": [ 3 | "ecma5", 4 | "browser", 5 | "jquery", 6 | "underscore" 7 | ], 8 | "plugins": { 9 | "angular": true, 10 | "node": {} 11 | } 12 | } -------------------------------------------------------------------------------- /views/templates/drawer.jade: -------------------------------------------------------------------------------- 1 | | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "less2css", 3 | "private": true, 4 | "dependencies": { 5 | "angular": "~1.2.15", 6 | "angular-animate": "~1.2.15", 7 | "bootstrap": "~3.1.1", 8 | "lodash": "~2.4.1" 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /cm/test/mode_test.css: -------------------------------------------------------------------------------- 1 | .mt-output .mt-token { 2 | border: 1px solid #ddd; 3 | white-space: pre; 4 | font-family: "Consolas", monospace; 5 | text-align: center; 6 | } 7 | 8 | .mt-output .mt-style { 9 | font-size: x-small; 10 | } 11 | -------------------------------------------------------------------------------- /public/stylesheets/style.less: -------------------------------------------------------------------------------- 1 | // Tweak bootstrap imports to customize for requirements 2 | @import "codemirror"; 3 | @import "bootstrap/bootstrap"; 4 | @import "bootstrap/responsive"; 5 | @import "app/gh"; 6 | @import "app/navbar"; 7 | @import "app/main"; -------------------------------------------------------------------------------- /public/javascripts/src/lodash-extenders.js: -------------------------------------------------------------------------------- 1 | _.mixin({ 2 | hasContent: function(obj) { 3 | return !_.isEmpty(obj); 4 | }, 5 | 6 | lastIndex: function(obj) { 7 | return _.size(obj) - 1; 8 | }, 9 | 10 | slice: function(obj, idx1, idx2) { 11 | return Array.prototype.slice.call(obj, idx1, idx2); 12 | } 13 | }); -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/controllers/AppCtrl.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .controller('AppCtrl', [ 4 | '$scope', 5 | 'LessOptions', 6 | function($scope, LessOptions) { 7 | $scope.opts = LessOptions.options; 8 | 9 | $scope.toggleDrawer = function(ev) { 10 | ev.preventDefault(); 11 | $scope.drawerOpen = !$scope.drawerOpen; 12 | }; 13 | } 14 | ]); 15 | -------------------------------------------------------------------------------- /views/404.jade: -------------------------------------------------------------------------------- 1 | extends layout 2 | 3 | block topScripts 4 | 5 | block header 6 | li.brand: a(href='/') LESS2CSS 7 | li.divider-vertical 8 | 9 | block content 10 | div.row-fluid 11 | div.span3.four-oh-four 12 | h1 4 13 | h1 0 14 | h1 4 15 | 16 | div.span9.four-oh-four.right-text 17 | h2 The page you are requesting does not exist. 18 | 19 | block bottomScripts -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/layouts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Layouts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Container (centered, fixed-width layouts) 7 | .container { 8 | .container-fixed(); 9 | } 10 | 11 | // Fluid layouts (left aligned, with sidebar, min- & max-width content) 12 | .container-fluid { 13 | padding-right: @gridGutterWidth; 14 | padding-left: @gridGutterWidth; 15 | .clearfix(); 16 | } -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/component-animations.less: -------------------------------------------------------------------------------- 1 | // 2 | // Component animations 3 | // -------------------------------------------------- 4 | 5 | 6 | .fade { 7 | opacity: 0; 8 | .transition(opacity .15s linear); 9 | &.in { 10 | opacity: 1; 11 | } 12 | } 13 | 14 | .collapse { 15 | position: relative; 16 | height: 0; 17 | overflow: hidden; 18 | .transition(height .35s ease); 19 | &.in { 20 | height: auto; 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /express/versions.js: -------------------------------------------------------------------------------- 1 | var q = require('q'); 2 | var path = require('path'); 3 | var exec = require('child_process').exec; 4 | 5 | exec('git tag', { 6 | cwd: path.join(__dirname, '../less') 7 | }, function(err, stdout, stderr) { 8 | if (err) { 9 | var errorMsg = ["Ummm, some issues w/ getting tags", err, stderr].join('\n'); 10 | console.error(errorMsg); 11 | process.exit(0); 12 | } 13 | 14 | var tags = stdout.split('\n'); 15 | console.log(tags); 16 | }); -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // Quick floats 7 | .pull-right { 8 | float: right; 9 | } 10 | .pull-left { 11 | float: left; 12 | } 13 | 14 | // Toggling content 15 | .hide { 16 | display: none; 17 | } 18 | .show { 19 | display: block; 20 | } 21 | 22 | // Visibility 23 | .invisible { 24 | visibility: hidden; 25 | } 26 | 27 | // For Affix plugin 28 | .affix { 29 | position: fixed; 30 | } 31 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/grid.less: -------------------------------------------------------------------------------- 1 | // 2 | // Grid system 3 | // -------------------------------------------------- 4 | 5 | 6 | // Fixed (940px) 7 | #grid > .core(@gridColumnWidth, @gridGutterWidth); 8 | 9 | // Fluid (940px) 10 | #grid > .fluid(@fluidGridColumnWidth, @fluidGridGutterWidth); 11 | 12 | // Reset utility classes due to specificity 13 | [class*="span"].hide, 14 | .row-fluid [class*="span"].hide { 15 | display: none; 16 | } 17 | 18 | [class*="span"].pull-right, 19 | .row-fluid [class*="span"].pull-right { 20 | float: right; 21 | } 22 | -------------------------------------------------------------------------------- /cm/theme/neat.css: -------------------------------------------------------------------------------- 1 | .cm-s-neat span.cm-comment { color: #a86; } 2 | .cm-s-neat span.cm-keyword { line-height: 1em; font-weight: bold; color: blue; } 3 | .cm-s-neat span.cm-string { color: #a22; } 4 | .cm-s-neat span.cm-builtin { line-height: 1em; font-weight: bold; color: #077; } 5 | .cm-s-neat span.cm-special { line-height: 1em; font-weight: bold; color: #0aa; } 6 | .cm-s-neat span.cm-variable { color: black; } 7 | .cm-s-neat span.cm-number, .cm-s-neat span.cm-atom { color: #3a3; } 8 | .cm-s-neat span.cm-meta {color: #555;} 9 | .cm-s-neat span.cm-link { color: #3a3; } 10 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/breadcrumbs.less: -------------------------------------------------------------------------------- 1 | // 2 | // Breadcrumbs 3 | // -------------------------------------------------- 4 | 5 | 6 | .breadcrumb { 7 | padding: 8px 15px; 8 | margin: 0 0 @baseLineHeight; 9 | list-style: none; 10 | background-color: #f5f5f5; 11 | .border-radius(@baseBorderRadius); 12 | > li { 13 | display: inline-block; 14 | .ie7-inline-block(); 15 | text-shadow: 0 1px 0 @white; 16 | > .divider { 17 | padding: 0 5px; 18 | color: #ccc; 19 | } 20 | } 21 | > .active { 22 | color: @grayLight; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive-768px-979px.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Tablet to desktop 3 | // -------------------------------------------------- 4 | 5 | 6 | @media (min-width: 768px) and (max-width: 979px) { 7 | 8 | // Fixed grid 9 | #grid > .core(@gridColumnWidth768, @gridGutterWidth768); 10 | 11 | // Fluid grid 12 | #grid > .fluid(@fluidGridColumnWidth768, @fluidGridGutterWidth768); 13 | 14 | // Input grid 15 | #grid > .input(@gridColumnWidth768, @gridGutterWidth768); 16 | 17 | // No need to reset .thumbnails here since it's the same @gridGutterWidth 18 | 19 | } 20 | -------------------------------------------------------------------------------- /cm/README.md: -------------------------------------------------------------------------------- 1 | # CodeMirror [![Build Status](https://secure.travis-ci.org/marijnh/CodeMirror.png?branch=master)](http://travis-ci.org/marijnh/CodeMirror) 2 | 3 | CodeMirror is a JavaScript component that provides a code editor in 4 | the browser. When a mode is available for the language you are coding 5 | in, it will color your code, and optionally help with indentation. 6 | 7 | The project page is http://codemirror.net 8 | The manual is at http://codemirror.net/doc/manual.html 9 | The contributing guidelines are in [CONTRIBUTING.md](https://github.com/marijnh/CodeMirror/blob/master/CONTRIBUTING.md) 10 | -------------------------------------------------------------------------------- /cm/theme/elegant.css: -------------------------------------------------------------------------------- 1 | .cm-s-elegant span.cm-number, .cm-s-elegant span.cm-string, .cm-s-elegant span.cm-atom {color: #762;} 2 | .cm-s-elegant span.cm-comment {color: #262; font-style: italic; line-height: 1em;} 3 | .cm-s-elegant span.cm-meta {color: #555; font-style: italic; line-height: 1em;} 4 | .cm-s-elegant span.cm-variable {color: black;} 5 | .cm-s-elegant span.cm-variable-2 {color: #b11;} 6 | .cm-s-elegant span.cm-qualifier {color: #555;} 7 | .cm-s-elegant span.cm-keyword {color: #730;} 8 | .cm-s-elegant span.cm-builtin {color: #30a;} 9 | .cm-s-elegant span.cm-error {background-color: #fdd;} 10 | .cm-s-elegant span.cm-link {color: #762;} 11 | -------------------------------------------------------------------------------- /todo.todo: -------------------------------------------------------------------------------- 1 | Routes: 2 | 3 | ☐ Hook up all routing 4 | ☐ Move route definitions to routes folder 5 | 6 | General: 7 | 8 | ☐ Add dev / prod hooks for conditional rendering 9 | 10 | Snippets: 11 | 12 | ☐ Define module and associated Mongoose schema 13 | ☐ Investigate utility of redis cache layer 14 | 15 | Gists: 16 | 17 | ☐ Hook up oAuth layer 18 | ☐ Create "sign in" 19 | ☐ Connect to gist api 20 | 21 | Build: 22 | 23 | ☐ Fix banners (use concat) 24 | ☐ Fix coffee build using manual task and concat 25 | ☐ Add daily build for pre-release (fetch dist and project and build) 26 | ☐ Move away from using github for LESS dist .js -------------------------------------------------------------------------------- /routes/index.js: -------------------------------------------------------------------------------- 1 | var lessOpts = require('../express/less-options'); 2 | 3 | module.exports = { 4 | four_oh_four: function(req, res) { 5 | res.status(404); 6 | 7 | if (req.accepts('html')) return res.render("404", { app: '', title: 'LESS2CSS | 404' }); 8 | if (req.accepts('json')) return res.send({ error: 'Not Found' }); 9 | return res.type('txt').send('404 Not Found'); 10 | }, 11 | 12 | home: function(req, res) { 13 | var opts = { app: 'Less2Css', title : 'LESS2CSS | LESS Live Preview' }; 14 | res.render('less2css', opts); 15 | }, 16 | 17 | less_options: function(req, res) { 18 | res.json(lessOpts); 19 | } 20 | }; 21 | -------------------------------------------------------------------------------- /express/shortener.js: -------------------------------------------------------------------------------- 1 | var alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789'.split(''); 2 | var base = alphabet.length; 3 | 4 | module.exports = { 5 | encode: function(i) { 6 | if (i === 0) return alphabet[0]; 7 | var s = ''; 8 | 9 | while (i > 0) { 10 | s += alphabet[i % base]; 11 | i = parseInt(i / base, 10); 12 | } 13 | 14 | return s.split('').reverse().join(''); 15 | }, 16 | 17 | decode: function(s) { 18 | var len = s.length; 19 | var i = 0; 20 | 21 | while (i < len) { 22 | var c = s[i]; 23 | var i = i * base + alphabet.indexOf(c); 24 | } 25 | 26 | return i; 27 | } 28 | }; -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/hero-unit.less: -------------------------------------------------------------------------------- 1 | // 2 | // Hero unit 3 | // -------------------------------------------------- 4 | 5 | 6 | .hero-unit { 7 | padding: 60px; 8 | margin-bottom: 30px; 9 | font-size: 18px; 10 | font-weight: 200; 11 | line-height: @baseLineHeight * 1.5; 12 | color: @heroUnitLeadColor; 13 | background-color: @heroUnitBackground; 14 | .border-radius(6px); 15 | h1 { 16 | margin-bottom: 0; 17 | font-size: 60px; 18 | line-height: 1; 19 | color: @heroUnitHeadingColor; 20 | letter-spacing: -1px; 21 | } 22 | li { 23 | line-height: @baseLineHeight * 1.5; // Reset since we specify in type.less 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /.jshintrc: -------------------------------------------------------------------------------- 1 | { 2 | "sub" : true, 3 | "boss" : true, 4 | "expr" : true, 5 | "node" : true, 6 | "devel" : true, 7 | "curly" : false, 8 | "immed" : true, 9 | "noarg" : true, 10 | "undef" : true, 11 | "newcap" : true, 12 | "shadow" : true, 13 | "newcap" : false, 14 | "eqnull" : true, 15 | "jquery" : true, 16 | "eqeqeq" : true, 17 | "browser" : true, 18 | "latedef" : false, 19 | "supernew" : true, 20 | "laxcomma" : false, 21 | "laxbreak" : true, 22 | "globals" : { 23 | "_" : true, 24 | "less" : true, 25 | "angular" : true, 26 | "CodeMirror" : true 27 | } 28 | } -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/wells.less: -------------------------------------------------------------------------------- 1 | // 2 | // Wells 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .well { 8 | min-height: 20px; 9 | padding: 19px; 10 | margin-bottom: 20px; 11 | background-color: @wellBackground; 12 | border: 1px solid darken(@wellBackground, 7%); 13 | .border-radius(@baseBorderRadius); 14 | .box-shadow(inset 0 1px 1px rgba(0,0,0,.05)); 15 | blockquote { 16 | border-color: #ddd; 17 | border-color: rgba(0,0,0,.15); 18 | } 19 | } 20 | 21 | // Sizes 22 | .well-large { 23 | padding: 24px; 24 | .border-radius(@borderRadiusLarge); 25 | } 26 | .well-small { 27 | padding: 9px; 28 | .border-radius(@borderRadiusSmall); 29 | } 30 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive-1200px-min.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Large desktop and up 3 | // -------------------------------------------------- 4 | 5 | 6 | @media (min-width: 1200px) { 7 | 8 | // Fixed grid 9 | #grid > .core(@gridColumnWidth1200, @gridGutterWidth1200); 10 | 11 | // Fluid grid 12 | #grid > .fluid(@fluidGridColumnWidth1200, @fluidGridGutterWidth1200); 13 | 14 | // Input grid 15 | #grid > .input(@gridColumnWidth1200, @gridGutterWidth1200); 16 | 17 | // Thumbnails 18 | .thumbnails { 19 | margin-left: -@gridGutterWidth1200; 20 | } 21 | .thumbnails > li { 22 | margin-left: @gridGutterWidth1200; 23 | } 24 | .row-fluid .thumbnails { 25 | margin-left: 0; 26 | } 27 | 28 | } 29 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/close.less: -------------------------------------------------------------------------------- 1 | // 2 | // Close icons 3 | // -------------------------------------------------- 4 | 5 | 6 | .close { 7 | float: right; 8 | font-size: 20px; 9 | font-weight: bold; 10 | line-height: @baseLineHeight; 11 | color: @black; 12 | text-shadow: 0 1px 0 rgba(255,255,255,1); 13 | .opacity(20); 14 | &:hover, 15 | &:focus { 16 | color: @black; 17 | text-decoration: none; 18 | cursor: pointer; 19 | .opacity(40); 20 | } 21 | } 22 | 23 | // Additional properties for button version 24 | // iOS requires the button element instead of an anchor tag. 25 | // If you want the anchor version, it requires `href="#"`. 26 | button.close { 27 | padding: 0; 28 | cursor: pointer; 29 | background: transparent; 30 | border: 0; 31 | -webkit-appearance: none; 32 | } 33 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/accordion.less: -------------------------------------------------------------------------------- 1 | // 2 | // Accordion 3 | // -------------------------------------------------- 4 | 5 | 6 | // Parent container 7 | .accordion { 8 | margin-bottom: @baseLineHeight; 9 | } 10 | 11 | // Group == heading + body 12 | .accordion-group { 13 | margin-bottom: 2px; 14 | border: 1px solid #e5e5e5; 15 | .border-radius(@baseBorderRadius); 16 | } 17 | .accordion-heading { 18 | border-bottom: 0; 19 | } 20 | .accordion-heading .accordion-toggle { 21 | display: block; 22 | padding: 8px 15px; 23 | } 24 | 25 | // General toggle styles 26 | .accordion-toggle { 27 | cursor: pointer; 28 | } 29 | 30 | // Inner needs the styles because you can't animate properly with any styles on the element 31 | .accordion-inner { 32 | padding: 9px 15px; 33 | border-top: 1px solid #e5e5e5; 34 | } 35 | -------------------------------------------------------------------------------- /less-preview.sublime-project: -------------------------------------------------------------------------------- 1 | { 2 | "folders": 3 | [ 4 | { 5 | "name": "Base", 6 | "follow_symlinks": true, 7 | "path": ".", 8 | "folder_exclude_patterns": ["*"] 9 | }, 10 | { 11 | "name": "CodeMirror", 12 | "path": "CodeMirror" 13 | }, 14 | { 15 | "name": "Express", 16 | "path": "express" 17 | }, 18 | { 19 | "name": "LESS", 20 | "path": "less" 21 | }, 22 | { 23 | "name": "Routes", 24 | "path": "routes" 25 | }, 26 | { 27 | "name": "Views", 28 | "path": "views" 29 | }, 30 | { 31 | "name": "Stylesheets", 32 | "path": "public/stylesheets" 33 | }, 34 | { 35 | "name": "JavaScripts", 36 | "path": "public/javascripts" 37 | }, 38 | { 39 | "name": "Components", 40 | "path": "public/components" 41 | } 42 | ] 43 | } 44 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/pager.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pager pagination 3 | // -------------------------------------------------- 4 | 5 | 6 | .pager { 7 | margin: @baseLineHeight 0; 8 | list-style: none; 9 | text-align: center; 10 | .clearfix(); 11 | } 12 | .pager li { 13 | display: inline; 14 | } 15 | .pager li > a, 16 | .pager li > span { 17 | display: inline-block; 18 | padding: 5px 14px; 19 | background-color: #fff; 20 | border: 1px solid #ddd; 21 | .border-radius(15px); 22 | } 23 | .pager li > a:hover, 24 | .pager li > a:focus { 25 | text-decoration: none; 26 | background-color: #f5f5f5; 27 | } 28 | .pager .next > a, 29 | .pager .next > span { 30 | float: right; 31 | } 32 | .pager .previous > a, 33 | .pager .previous > span { 34 | float: left; 35 | } 36 | .pager .disabled > a, 37 | .pager .disabled > a:hover, 38 | .pager .disabled > a:focus, 39 | .pager .disabled > span { 40 | color: @grayLight; 41 | background-color: #fff; 42 | cursor: default; 43 | } 44 | -------------------------------------------------------------------------------- /cm/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "codemirror", 3 | "version":"3.0.21", 4 | "main": "codemirror.js", 5 | "description": "In-browser code editing made bearable", 6 | "licenses": [{"type": "MIT", 7 | "url": "http://codemirror.net/LICENSE"}], 8 | "directories": {"lib": "./lib"}, 9 | "scripts": {"test": "node ./test/run.js"}, 10 | "devDependencies": {"node-static": "0.6.0"}, 11 | "bugs": "http://github.com/marijnh/CodeMirror/issues", 12 | "keywords": ["JavaScript", "CodeMirror", "Editor"], 13 | "homepage": "http://codemirror.net", 14 | "maintainers":[{"name": "Marijn Haverbeke", 15 | "email": "marijnh@gmail.com", 16 | "web": "http://marijnhaverbeke.nl"}], 17 | "repositories": [{"type": "git", 18 | "url": "http://marijnhaverbeke.nl/git/codemirror"}, 19 | {"type": "git", 20 | "url": "https://github.com/marijnh/CodeMirror.git"}] 21 | } 22 | -------------------------------------------------------------------------------- /cm/test/run.js: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | var lint = require("./lint/lint"); 4 | 5 | lint.checkDir("mode"); 6 | lint.checkDir("lib"); 7 | 8 | var ok = lint.success(); 9 | 10 | var files = new (require('node-static').Server)('.'); 11 | 12 | var server = require('http').createServer(function (req, res) { 13 | req.addListener('end', function () { 14 | files.serve(req, res); 15 | }); 16 | }).addListener('error', function (err) { 17 | throw err; 18 | }).listen(3000, function () { 19 | var child_process = require('child_process'); 20 | child_process.exec("which phantomjs", function (err) { 21 | if (err) { 22 | console.error("PhantomJS is not installed. Download from http://phantomjs.org"); 23 | process.exit(1); 24 | } 25 | var cmd = 'phantomjs test/phantom_driver.js'; 26 | child_process.exec(cmd, function (err, stdout) { 27 | server.close(); 28 | console.log(stdout); 29 | process.exit(err || !ok ? 1 : 0); 30 | }); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /cm/test/phantom_driver.js: -------------------------------------------------------------------------------- 1 | var page = require('webpage').create(); 2 | 3 | page.open("http://localhost:3000/test/index.html", function (status) { 4 | if (status != "success") { 5 | console.log("page couldn't be loaded successfully"); 6 | phantom.exit(1); 7 | } 8 | waitFor(function () { 9 | return page.evaluate(function () { 10 | var output = document.getElementById('status'); 11 | if (!output) { return false; } 12 | return (/^(\d+ failures?|all passed)/i).test(output.innerText); 13 | }); 14 | }, function () { 15 | var failed = page.evaluate(function () { return window.failed; }); 16 | var output = page.evaluate(function () { 17 | return document.getElementById('output').innerText + "\n" + 18 | document.getElementById('status').innerText; 19 | }); 20 | console.log(output); 21 | phantom.exit(failed > 0 ? 1 : 0); 22 | }); 23 | }); 24 | 25 | function waitFor (test, cb) { 26 | if (test()) { 27 | cb(); 28 | } else { 29 | setTimeout(function () { waitFor(test, cb); }, 250); 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /cm/theme/cobalt.css: -------------------------------------------------------------------------------- 1 | .cm-s-cobalt.CodeMirror { background: #002240; color: white; } 2 | .cm-s-cobalt div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-cobalt .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-cobalt .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-cobalt .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-cobalt span.cm-comment { color: #08f; } 8 | .cm-s-cobalt span.cm-atom { color: #845dc4; } 9 | .cm-s-cobalt span.cm-number, .cm-s-cobalt span.cm-attribute { color: #ff80e1; } 10 | .cm-s-cobalt span.cm-keyword { color: #ffee80; } 11 | .cm-s-cobalt span.cm-string { color: #3ad900; } 12 | .cm-s-cobalt span.cm-meta { color: #ff9d00; } 13 | .cm-s-cobalt span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #9effff; } 14 | .cm-s-cobalt span.cm-variable-3, .cm-s-cobalt span.cm-def { color: white; } 15 | .cm-s-cobalt span.cm-error { color: #9d1e15; } 16 | .cm-s-cobalt span.cm-bracket { color: #d8d8d8; } 17 | .cm-s-cobalt span.cm-builtin, .cm-s-cobalt span.cm-special { color: #ff9e59; } 18 | .cm-s-cobalt span.cm-link { color: #845dc4; } 19 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/media.less: -------------------------------------------------------------------------------- 1 | // Media objects 2 | // Source: http://stubbornella.org/content/?p=497 3 | // -------------------------------------------------- 4 | 5 | 6 | // Common styles 7 | // ------------------------- 8 | 9 | // Clear the floats 10 | .media, 11 | .media-body { 12 | overflow: hidden; 13 | *overflow: visible; 14 | zoom: 1; 15 | } 16 | 17 | // Proper spacing between instances of .media 18 | .media, 19 | .media .media { 20 | margin-top: 15px; 21 | } 22 | .media:first-child { 23 | margin-top: 0; 24 | } 25 | 26 | // For images and videos, set to block 27 | .media-object { 28 | display: block; 29 | } 30 | 31 | // Reset margins on headings for tighter default spacing 32 | .media-heading { 33 | margin: 0 0 5px; 34 | } 35 | 36 | 37 | // Media image alignment 38 | // ------------------------- 39 | 40 | .media > .pull-left { 41 | margin-right: 10px; 42 | } 43 | .media > .pull-right { 44 | margin-left: 10px; 45 | } 46 | 47 | 48 | // Media list variation 49 | // ------------------------- 50 | 51 | // Undo default ul/ol styles 52 | .media-list { 53 | margin-left: 0; 54 | list-style: none; 55 | } 56 | -------------------------------------------------------------------------------- /cm/theme/eclipse.css: -------------------------------------------------------------------------------- 1 | .cm-s-eclipse span.cm-meta {color: #FF1717;} 2 | .cm-s-eclipse span.cm-keyword { line-height: 1em; font-weight: bold; color: #7F0055; } 3 | .cm-s-eclipse span.cm-atom {color: #219;} 4 | .cm-s-eclipse span.cm-number {color: #164;} 5 | .cm-s-eclipse span.cm-def {color: #00f;} 6 | .cm-s-eclipse span.cm-variable {color: black;} 7 | .cm-s-eclipse span.cm-variable-2 {color: #0000C0;} 8 | .cm-s-eclipse span.cm-variable-3 {color: #0000C0;} 9 | .cm-s-eclipse span.cm-property {color: black;} 10 | .cm-s-eclipse span.cm-operator {color: black;} 11 | .cm-s-eclipse span.cm-comment {color: #3F7F5F;} 12 | .cm-s-eclipse span.cm-string {color: #2A00FF;} 13 | .cm-s-eclipse span.cm-string-2 {color: #f50;} 14 | .cm-s-eclipse span.cm-error {color: #f00;} 15 | .cm-s-eclipse span.cm-qualifier {color: #555;} 16 | .cm-s-eclipse span.cm-builtin {color: #30a;} 17 | .cm-s-eclipse span.cm-bracket {color: #cc7;} 18 | .cm-s-eclipse span.cm-tag {color: #170;} 19 | .cm-s-eclipse span.cm-attribute {color: #00c;} 20 | .cm-s-eclipse span.cm-link {color: #219;} 21 | 22 | .cm-s-eclipse .CodeMirror-matchingbracket { 23 | border:1px solid grey; 24 | color:black !important;; 25 | } 26 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/scaffolding.less: -------------------------------------------------------------------------------- 1 | // 2 | // Scaffolding 3 | // -------------------------------------------------- 4 | 5 | 6 | // Body reset 7 | // ------------------------- 8 | 9 | body { 10 | margin: 0; 11 | font-family: @baseFontFamily; 12 | font-size: @baseFontSize; 13 | line-height: @baseLineHeight; 14 | color: @textColor; 15 | background-color: @bodyBackground; 16 | } 17 | 18 | 19 | // Links 20 | // ------------------------- 21 | 22 | a { 23 | color: @linkColor; 24 | text-decoration: none; 25 | } 26 | a:hover, 27 | a:focus { 28 | color: @linkColorHover; 29 | text-decoration: underline; 30 | } 31 | 32 | 33 | // Images 34 | // ------------------------- 35 | 36 | // Rounded corners 37 | .img-rounded { 38 | .border-radius(6px); 39 | } 40 | 41 | // Add polaroid-esque trim 42 | .img-polaroid { 43 | padding: 4px; 44 | background-color: #fff; 45 | border: 1px solid #ccc; 46 | border: 1px solid rgba(0,0,0,.2); 47 | .box-shadow(0 1px 3px rgba(0,0,0,.1)); 48 | } 49 | 50 | // Perfect circle 51 | .img-circle { 52 | .border-radius(500px); // crank the border-radius so it works with most reasonably sized images 53 | } 54 | -------------------------------------------------------------------------------- /public/javascripts/src/Stor/angular-stor.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Stor', []) 3 | .factory('Stor', [ 4 | '$q', 5 | '$window', 6 | '$timeout', 7 | '$rootScope', 8 | function($q, $window, $timeout, $rootScope) { 9 | var StorageClass = $window.Stor; 10 | 11 | _.extend(StorageClass.prototype, { 12 | getAsync: function(fn) { 13 | var ret = {}; 14 | var self = this; 15 | var data = self.get.call(self); // Try from localStorage 16 | var deferred = $q.defer(); 17 | var req; 18 | 19 | if (data) { 20 | var mockdefer = $q.defer(); 21 | req = mockdefer.promise; 22 | 23 | $timeout(function() { 24 | mockdefer.resolve({ data: data, status: 200, type: 'local' }); 25 | }, 1, false); 26 | } else { 27 | req = fn(); 28 | ret.type = 'xhr'; 29 | } 30 | 31 | req.then(function(res) { 32 | return $rootScope.$safeApply(function() { 33 | _.extend(ret, res); 34 | deferred.resolve(ret); 35 | }); 36 | }); 37 | 38 | return deferred.promise; 39 | } 40 | }); 41 | 42 | return StorageClass; 43 | } 44 | ]); -------------------------------------------------------------------------------- /cm/theme/night.css: -------------------------------------------------------------------------------- 1 | /* Loosely based on the Midnight Textmate theme */ 2 | 3 | .cm-s-night.CodeMirror { background: #0a001f; color: #f8f8f8; } 4 | .cm-s-night div.CodeMirror-selected { background: #447 !important; } 5 | .cm-s-night .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 6 | .cm-s-night .CodeMirror-linenumber { color: #f8f8f8; } 7 | .cm-s-night .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-night span.cm-comment { color: #6900a1; } 10 | .cm-s-night span.cm-atom { color: #845dc4; } 11 | .cm-s-night span.cm-number, .cm-s-night span.cm-attribute { color: #ffd500; } 12 | .cm-s-night span.cm-keyword { color: #599eff; } 13 | .cm-s-night span.cm-string { color: #37f14a; } 14 | .cm-s-night span.cm-meta { color: #7678e2; } 15 | .cm-s-night span.cm-variable-2, .cm-s-night span.cm-tag { color: #99b2ff; } 16 | .cm-s-night span.cm-variable-3, .cm-s-night span.cm-def { color: white; } 17 | .cm-s-night span.cm-error { color: #9d1e15; } 18 | .cm-s-night span.cm-bracket { color: #8da6ce; } 19 | .cm-s-night span.cm-comment { color: #6900a1; } 20 | .cm-s-night span.cm-builtin, .cm-s-night span.cm-special { color: #ff9e59; } 21 | .cm-s-night span.cm-link { color: #845dc4; } 22 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/less2css.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css', ['Stor', 'TransitionHelper']) 3 | .config([ 4 | '$provide', 5 | function($provide) { 6 | $provide.decorator('$rootScope', [ 7 | '$delegate', 8 | function($rootScope) { 9 | $rootScope.$safeApply = function() { 10 | var $scope, fn; 11 | var args = arguments; 12 | var force = false; 13 | 14 | switch (args.length) { 15 | case 1: 16 | var arg = args[0]; 17 | if (_.isFunction(arg)) fn = arg; 18 | else $scope = arg; 19 | break; 20 | case 3: 21 | force = !!args[2]; 22 | /* falls through */ 23 | case 2: 24 | $scope = args[0]; 25 | fn = args[1]; 26 | break; 27 | } 28 | 29 | $scope = $scope || $rootScope; 30 | fn = fn || _.noop; 31 | 32 | if(force || !$scope.$$phase) { 33 | $scope.$apply ? $scope.$apply(fn) : $scope.apply(fn); 34 | } else { 35 | fn(); 36 | } 37 | }; 38 | 39 | return $rootScope; 40 | } 41 | ]); 42 | } 43 | ]); -------------------------------------------------------------------------------- /cm/demo/resize.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Autoresize Demo 6 | 7 | 8 | 9 | 10 | 11 | 21 | 22 | 23 |

CodeMirror: Autoresize demo

24 | 25 |
35 | 36 |

By setting a few CSS properties, CodeMirror can be made to 37 | automatically resize to fit its content.

38 | 39 | 44 | 45 | 46 | 47 | -------------------------------------------------------------------------------- /cm/theme/monokai.css: -------------------------------------------------------------------------------- 1 | /* Based on Sublime Text's Monokai theme */ 2 | 3 | .cm-s-monokai.CodeMirror {background: #272822; color: #f8f8f2;} 4 | .cm-s-monokai div.CodeMirror-selected {background: #49483E !important;} 5 | .cm-s-monokai .CodeMirror-gutters {background: #272822; border-right: 0px;} 6 | .cm-s-monokai .CodeMirror-linenumber {color: #d0d0d0;} 7 | .cm-s-monokai .CodeMirror-cursor {border-left: 1px solid #f8f8f0 !important;} 8 | 9 | .cm-s-monokai span.cm-comment {color: #75715e;} 10 | .cm-s-monokai span.cm-atom {color: #ae81ff;} 11 | .cm-s-monokai span.cm-number {color: #ae81ff;} 12 | 13 | .cm-s-monokai span.cm-property, .cm-s-monokai span.cm-attribute {color: #a6e22e;} 14 | .cm-s-monokai span.cm-keyword {color: #f92672;} 15 | .cm-s-monokai span.cm-string {color: #e6db74;} 16 | 17 | .cm-s-monokai span.cm-variable {color: #a6e22e;} 18 | .cm-s-monokai span.cm-variable-2 {color: #9effff;} 19 | .cm-s-monokai span.cm-def {color: #fd971f;} 20 | .cm-s-monokai span.cm-error {background: #f92672; color: #f8f8f0;} 21 | .cm-s-monokai span.cm-bracket {color: #f8f8f2;} 22 | .cm-s-monokai span.cm-tag {color: #f92672;} 23 | .cm-s-monokai span.cm-link {color: #ae81ff;} 24 | 25 | .cm-s-monokai .CodeMirror-matchingbracket { 26 | text-decoration: underline; 27 | color: white !important; 28 | } 29 | -------------------------------------------------------------------------------- /express/less-express-compiler.js: -------------------------------------------------------------------------------- 1 | var __ = require('lodash'); 2 | var lessOpts = require('./less-options'); 3 | var lessPath = '../public/javascripts/less'; 4 | var LessCompiler; 5 | 6 | exports.LessCompiler = LessCompiler = (function(){ 7 | function LessCompiler(version, options) { 8 | this.version = version || __.find(lessOpts.lessVersions, function(version) { 9 | return version.type === 'current'; 10 | }); 11 | this.options = options || lessOpts.lessOptions; 12 | this.setupVersions(lessOpts.lessVersions); 13 | } 14 | 15 | LessCompiler.prototype = { 16 | setupVersions: function(versions) { 17 | var len = versions.length; 18 | var i = 0; 19 | 20 | this.versions = []; 21 | 22 | while(i < len) { 23 | var version = versions[i]; 24 | var obj = {}; 25 | var sub = version.type === 'pre' ? version.label.replace(/[\d\.]+\s\(([\w\d-]+)\)/i, '-$1') : ''; 26 | var fileName = 'less-' + version.number + sub; 27 | 28 | obj.version = version.number; 29 | obj.less = require(lessPath + "/" + fileName); 30 | // File still WIP 31 | this.versions.push(obj); 32 | i++; 33 | } 34 | }, 35 | 36 | compile: function(version, options) {} 37 | }; 38 | 39 | return LessCompiler; 40 | }()); -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/directives/drawer.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .directive('drawer', [ 4 | 'TransitionHelper', 5 | function(TransitionHelper) { 6 | return { 7 | replace : true, 8 | restrict : 'E', 9 | transclude : true, 10 | templateUrl : 'drawer.html', 11 | scope: { 12 | open : '=', 13 | opts : '=', 14 | offset : '=', 15 | position : '=' 16 | }, 17 | 18 | link: function(scope, elem) { 19 | var el = scope.el = elem[0]; 20 | var translateAxis = scope.position === 'top' || scope.position === 'bottom' 21 | ? 'Y' 22 | : 'X'; 23 | 24 | function toggleDrawer(isOpen) { 25 | updateModelDimensions(); 26 | 27 | var translateVal = isOpen 28 | ? scope.offset 29 | : -scope.height + _.parseInt(scope.offset); 30 | 31 | TransitionHelper['translate' + translateAxis](el, translateVal); 32 | el.style.opacity = isOpen ? 1 : 0; 33 | } 34 | 35 | function updateModelDimensions() { 36 | scope.height = el.offsetHeight; 37 | scope.width = el.offsetWidth; 38 | } 39 | 40 | scope.$watch('open', toggleDrawer); 41 | } 42 | }; 43 | } 44 | ]); -------------------------------------------------------------------------------- /cm/LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (C) 2012 by Marijn Haverbeke 2 | 3 | Permission is hereby granted, free of charge, to any person obtaining a copy 4 | of this software and associated documentation files (the "Software"), to deal 5 | in the Software without restriction, including without limitation the rights 6 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 7 | copies of the Software, and to permit persons to whom the Software is 8 | furnished to do so, subject to the following conditions: 9 | 10 | The above copyright notice and this permission notice shall be included in 11 | all copies or substantial portions of the Software. 12 | 13 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 14 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 15 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 16 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 17 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 18 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 19 | THE SOFTWARE. 20 | 21 | Please note that some subdirectories of the CodeMirror distribution 22 | include their own LICENSE files, and are released under different 23 | licences. 24 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap Responsive v2.3.2 3 | * 4 | * Copyright 2012 Twitter, Inc 5 | * Licensed under the Apache License v2.0 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Designed and built with all the love in the world @twitter by @mdo and @fat. 9 | */ 10 | 11 | 12 | // Responsive.less 13 | // For phone and tablet devices 14 | // ------------------------------------------------------------- 15 | 16 | 17 | // REPEAT VARIABLES & MIXINS 18 | // ------------------------- 19 | // Required since we compile the responsive stuff separately 20 | 21 | @import "variables.less"; // Modify this for custom colors, font-sizes, etc 22 | @import "mixins.less"; 23 | 24 | 25 | // RESPONSIVE CLASSES 26 | // ------------------ 27 | 28 | @import "responsive-utilities.less"; 29 | 30 | 31 | // MEDIA QUERIES 32 | // ------------------ 33 | 34 | // Large desktops 35 | @import "responsive-1200px-min.less"; 36 | 37 | // Tablets to regular desktops 38 | @import "responsive-768px-979px.less"; 39 | 40 | // Phones to portrait tablets and narrow desktops 41 | @import "responsive-767px-max.less"; 42 | 43 | 44 | // RESPONSIVE NAVBAR 45 | // ------------------ 46 | 47 | // From 979px and below, show a button to toggle navbar contents 48 | @import "responsive-navbar.less"; 49 | -------------------------------------------------------------------------------- /cm/theme/erlang-dark.css: -------------------------------------------------------------------------------- 1 | .cm-s-erlang-dark.CodeMirror { background: #002240; color: white; } 2 | .cm-s-erlang-dark div.CodeMirror-selected { background: #b36539 !important; } 3 | .cm-s-erlang-dark .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 4 | .cm-s-erlang-dark .CodeMirror-linenumber { color: #d0d0d0; } 5 | .cm-s-erlang-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 6 | 7 | .cm-s-erlang-dark span.cm-atom { color: #845dc4; } 8 | .cm-s-erlang-dark span.cm-attribute { color: #ff80e1; } 9 | .cm-s-erlang-dark span.cm-bracket { color: #ff9d00; } 10 | .cm-s-erlang-dark span.cm-builtin { color: #eeaaaa; } 11 | .cm-s-erlang-dark span.cm-comment { color: #7777ff; } 12 | .cm-s-erlang-dark span.cm-def { color: #ee77aa; } 13 | .cm-s-erlang-dark span.cm-error { color: #9d1e15; } 14 | .cm-s-erlang-dark span.cm-keyword { color: #ffee80; } 15 | .cm-s-erlang-dark span.cm-meta { color: #50fefe; } 16 | .cm-s-erlang-dark span.cm-number { color: #ffd0d0; } 17 | .cm-s-erlang-dark span.cm-operator { color: #dd1111; } 18 | .cm-s-erlang-dark span.cm-string { color: #3ad900; } 19 | .cm-s-erlang-dark span.cm-tag { color: #9effff; } 20 | .cm-s-erlang-dark span.cm-variable { color: #50fe50; } 21 | .cm-s-erlang-dark span.cm-variable-2 { color: #ee00ee; } 22 | -------------------------------------------------------------------------------- /cm/theme/blackboard.css: -------------------------------------------------------------------------------- 1 | /* Port of TextMate's Blackboard theme */ 2 | 3 | .cm-s-blackboard.CodeMirror { background: #0C1021; color: #F8F8F8; } 4 | .cm-s-blackboard .CodeMirror-selected { background: #253B76 !important; } 5 | .cm-s-blackboard .CodeMirror-gutters { background: #0C1021; border-right: 0; } 6 | .cm-s-blackboard .CodeMirror-linenumber { color: #888; } 7 | .cm-s-blackboard .CodeMirror-cursor { border-left: 1px solid #A7A7A7 !important; } 8 | 9 | .cm-s-blackboard .cm-keyword { color: #FBDE2D; } 10 | .cm-s-blackboard .cm-atom { color: #D8FA3C; } 11 | .cm-s-blackboard .cm-number { color: #D8FA3C; } 12 | .cm-s-blackboard .cm-def { color: #8DA6CE; } 13 | .cm-s-blackboard .cm-variable { color: #FF6400; } 14 | .cm-s-blackboard .cm-operator { color: #FBDE2D;} 15 | .cm-s-blackboard .cm-comment { color: #AEAEAE; } 16 | .cm-s-blackboard .cm-string { color: #61CE3C; } 17 | .cm-s-blackboard .cm-string-2 { color: #61CE3C; } 18 | .cm-s-blackboard .cm-meta { color: #D8FA3C; } 19 | .cm-s-blackboard .cm-error { background: #9D1E15; color: #F8F8F8; } 20 | .cm-s-blackboard .cm-builtin { color: #8DA6CE; } 21 | .cm-s-blackboard .cm-tag { color: #8DA6CE; } 22 | .cm-s-blackboard .cm-attribute { color: #8DA6CE; } 23 | .cm-s-blackboard .cm-header { color: #FF6400; } 24 | .cm-s-blackboard .cm-hr { color: #AEAEAE; } 25 | .cm-s-blackboard .cm-link { color: #8DA6CE; } 26 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/directives/lessEditor.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .directive('lessEditor', [ 4 | 'LessOptions', 5 | function(LessOptions) { 6 | return { 7 | restrict: 'A', 8 | require: 'ngModel', 9 | link: function(scope, elem, attrs, ngModel) { 10 | var el = elem[0]; 11 | scope.opts = LessOptions.options; 12 | // Parse and render initial viewValue for CodeMirror 13 | ngModel.$setViewValue(scope.$eval(attrs.ngModel) || el.value); 14 | ngModel.$render(); 15 | 16 | function deferCodeMirror() { 17 | var opts = scope.opts.lessEditorOptions; 18 | var codeMirror = CodeMirror.fromTextArea(el, opts); 19 | 20 | codeMirror.on('change', onChange(opts.onChange)); 21 | 22 | ngModel.$render = function() { 23 | codeMirror.setValue(ngModel.$viewValue); 24 | }; 25 | } 26 | 27 | function onChange() { 28 | return function(instance, changeObj) { 29 | var newValue = instance.getValue(); 30 | 31 | if (newValue !== ngModel.$viewValue) { 32 | ngModel.$setViewValue(newValue); 33 | scope.$apply(); 34 | } 35 | }; 36 | } 37 | 38 | LessOptions.request.then(deferCodeMirror); 39 | } 40 | }; 41 | } 42 | ]); 43 | -------------------------------------------------------------------------------- /cm/theme/rubyblue.css: -------------------------------------------------------------------------------- 1 | .cm-s-rubyblue { font:13px/1.4em Trebuchet, Verdana, sans-serif; } /* - customized editor font - */ 2 | 3 | .cm-s-rubyblue.CodeMirror { background: #112435; color: white; } 4 | .cm-s-rubyblue div.CodeMirror-selected { background: #38566F !important; } 5 | .cm-s-rubyblue .CodeMirror-gutters { background: #1F4661; border-right: 7px solid #3E7087; } 6 | .cm-s-rubyblue .CodeMirror-linenumber { color: white; } 7 | .cm-s-rubyblue .CodeMirror-cursor { border-left: 1px solid white !important; } 8 | 9 | .cm-s-rubyblue span.cm-comment { color: #999; font-style:italic; line-height: 1em; } 10 | .cm-s-rubyblue span.cm-atom { color: #F4C20B; } 11 | .cm-s-rubyblue span.cm-number, .cm-s-rubyblue span.cm-attribute { color: #82C6E0; } 12 | .cm-s-rubyblue span.cm-keyword { color: #F0F; } 13 | .cm-s-rubyblue span.cm-string { color: #F08047; } 14 | .cm-s-rubyblue span.cm-meta { color: #F0F; } 15 | .cm-s-rubyblue span.cm-variable-2, .cm-s-rubyblue span.cm-tag { color: #7BD827; } 16 | .cm-s-rubyblue span.cm-variable-3, .cm-s-rubyblue span.cm-def { color: white; } 17 | .cm-s-rubyblue span.cm-error { color: #AF2018; } 18 | .cm-s-rubyblue span.cm-bracket { color: #F0F; } 19 | .cm-s-rubyblue span.cm-link { color: #F4C20B; } 20 | .cm-s-rubyblue span.CodeMirror-matchingbracket { color:#F0F !important; } 21 | .cm-s-rubyblue span.cm-builtin, .cm-s-rubyblue span.cm-special { color: #FF9D00; } 22 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "less2css", 3 | "description": "Converts LESS to CSS and does other awesome stuff", 4 | "version": "0.0.9", 5 | "private": true, 6 | "author": "Brian Frichette", 7 | "homepage": "http://less2css.org/", 8 | "contributors": [ 9 | "Brian Frichette (https://github.com/brian-frichette)", 10 | "Scott Rippey (https://github.com/scottrippey)" 11 | ], 12 | "bugs": { 13 | "url": "https://github.com/brian-frichette/less-preview/issues" 14 | }, 15 | "scripts": { 16 | "start": "nodemon app.js", 17 | "prod": "forever start app.js -l" 18 | }, 19 | "dependencies": { 20 | "forever": "~0.10.11", 21 | "express": "~3.4.8", 22 | "jade": "~1.3.0", 23 | "lodash": "~2.4", 24 | "q": "^1.0.1" 25 | }, 26 | "devDependencies": { 27 | "grunt": "~0.4.3", 28 | "grunt-config-merge": "^1.1.0", 29 | "grunt-contrib-concat": "~0.3.0", 30 | "grunt-contrib-jshint": "~0.9.2", 31 | "grunt-contrib-less": "^0.11.0", 32 | "grunt-contrib-uglify": "~0.4.0", 33 | "grunt-contrib-watch": "~0.6.1", 34 | "nodemon": "~1.2.0" 35 | }, 36 | "keywords": [ 37 | "less", 38 | "lesscss" 39 | ], 40 | "repository": "git://github.com/brian-frichette/less-preview.git", 41 | "licenses": [ 42 | { 43 | "type": "MIT", 44 | "url": "http://opensource.org/licenses/MIT" 45 | } 46 | ] 47 | } 48 | -------------------------------------------------------------------------------- /cm/demo/matchhighlighter.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Match Highlighter Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 18 | 19 | 20 |

CodeMirror: Match Highlighter Demo

21 | 22 |
25 | 26 | 32 | 33 |

Highlight matches of selected text on select

34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /cm/demo/loadmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Lazy Mode Loading Demo 6 | 7 | 8 | 9 | 10 | 11 | 14 | 15 | 16 |

CodeMirror: Lazy Mode Loading

17 | 18 |
23 |

24 | 25 | 39 | 40 | 41 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/thumbnails.less: -------------------------------------------------------------------------------- 1 | // 2 | // Thumbnails 3 | // -------------------------------------------------- 4 | 5 | 6 | // Note: `.thumbnails` and `.thumbnails > li` are overriden in responsive files 7 | 8 | // Make wrapper ul behave like the grid 9 | .thumbnails { 10 | margin-left: -@gridGutterWidth; 11 | list-style: none; 12 | .clearfix(); 13 | } 14 | // Fluid rows have no left margin 15 | .row-fluid .thumbnails { 16 | margin-left: 0; 17 | } 18 | 19 | // Float li to make thumbnails appear in a row 20 | .thumbnails > li { 21 | float: left; // Explicity set the float since we don't require .span* classes 22 | margin-bottom: @baseLineHeight; 23 | margin-left: @gridGutterWidth; 24 | } 25 | 26 | // The actual thumbnail (can be `a` or `div`) 27 | .thumbnail { 28 | display: block; 29 | padding: 4px; 30 | line-height: @baseLineHeight; 31 | border: 1px solid #ddd; 32 | .border-radius(@baseBorderRadius); 33 | .box-shadow(0 1px 3px rgba(0,0,0,.055)); 34 | .transition(all .2s ease-in-out); 35 | } 36 | // Add a hover/focus state for linked versions only 37 | a.thumbnail:hover, 38 | a.thumbnail:focus { 39 | border-color: @linkColor; 40 | .box-shadow(0 1px 4px rgba(0,105,214,.25)); 41 | } 42 | 43 | // Images and captions 44 | .thumbnail > img { 45 | display: block; 46 | max-width: 100%; 47 | margin-left: auto; 48 | margin-right: auto; 49 | } 50 | .thumbnail .caption { 51 | padding: 9px; 52 | color: @gray; 53 | } 54 | -------------------------------------------------------------------------------- /changelog.md: -------------------------------------------------------------------------------- 1 | # Changelog 2 | 3 | ### 0.0.9 4 | - Test 5 | 6 | ### 0.0.8 7 | - Fix issue where error of type `File` (e.g. 404 on @import) kills the parser until refresh. 8 | - Fix bug in `Stor` where cache doesn't expire 9 | - Added daily options check to keep versions up to date and allow additional options 10 | - Clean-up modules and upgrade Lodash to 2.4.1 11 | - Update Less to 1.5.1 12 | 13 | ### 0.0.7 14 | - Huge refactor / mess reduction 15 | - Fixed LESS core stuff from 1.4 16 | - Lots of styling improvements 17 | 18 | ### 0.0.6 19 | - Major changes to build 20 | - Converted to from Coffee to full JS 21 | - Rename `strictMaths` to `strictMath` per LESS 1.4 beta 22 | 23 | ### 0.0.5 24 | - Added "Legacy Maths/Units" for LESS 1.4 compatibility. 25 | - Upgraded Grunt and all Grunt-contrib to 0.4.0 stable 26 | - Various tweaks and improvements 27 | 28 | ### 0.0.4 29 | - Converted site to AngularJS for a better framework to manage future feature additions 30 | - Removed highlight.js 31 | - Both input and output use CodeMirror editors now for line-numbers and easily selectable CSS 32 | - Some styling and performance tweaks 33 | 34 | ### 0.0.3 35 | - Added options drawer for better control 36 | - Cleaned up build process 37 | - Added middleware for better performance / security 38 | 39 | ### 0.0.2 40 | - No longer running on gh-pages. 41 | - Re-wrote with Express and Coffeescript 42 | - Grunt build 43 | - Added pre-release LESS 44 | -------------------------------------------------------------------------------- /cm/demo/closetag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Close-Tag Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 17 | 18 | 19 | 20 |

Close-Tag Demo

21 | 27 | 28 |
29 | 30 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /cm/theme/vibrant-ink.css: -------------------------------------------------------------------------------- 1 | /* Taken from the popular Visual Studio Vibrant Ink Schema */ 2 | 3 | .cm-s-vibrant-ink.CodeMirror { background: black; color: white; } 4 | .cm-s-vibrant-ink .CodeMirror-selected { background: #35493c !important; } 5 | 6 | .cm-s-vibrant-ink .CodeMirror-gutters { background: #002240; border-right: 1px solid #aaa; } 7 | .cm-s-vibrant-ink .CodeMirror-linenumber { color: #d0d0d0; } 8 | .cm-s-vibrant-ink .CodeMirror-cursor { border-left: 1px solid white !important; } 9 | 10 | .cm-s-vibrant-ink .cm-keyword { color: #CC7832; } 11 | .cm-s-vibrant-ink .cm-atom { color: #FC0; } 12 | .cm-s-vibrant-ink .cm-number { color: #FFEE98; } 13 | .cm-s-vibrant-ink .cm-def { color: #8DA6CE; } 14 | .cm-s-vibrant-ink span.cm-variable-2, .cm-s-cobalt span.cm-tag { color: #FFC66D } 15 | .cm-s-vibrant-ink span.cm-variable-3, .cm-s-cobalt span.cm-def { color: #FFC66D } 16 | .cm-s-vibrant-ink .cm-operator { color: #888; } 17 | .cm-s-vibrant-ink .cm-comment { color: gray; font-weight: bold; } 18 | .cm-s-vibrant-ink .cm-string { color: #A5C25C } 19 | .cm-s-vibrant-ink .cm-string-2 { color: red } 20 | .cm-s-vibrant-ink .cm-meta { color: #D8FA3C; } 21 | .cm-s-vibrant-ink .cm-error { border-bottom: 1px solid red; } 22 | .cm-s-vibrant-ink .cm-builtin { color: #8DA6CE; } 23 | .cm-s-vibrant-ink .cm-tag { color: #8DA6CE; } 24 | .cm-s-vibrant-ink .cm-attribute { color: #8DA6CE; } 25 | .cm-s-vibrant-ink .cm-header { color: #FF6400; } 26 | .cm-s-vibrant-ink .cm-hr { color: #AEAEAE; } 27 | .cm-s-vibrant-ink .cm-link { color: blue; } 28 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | ###SublimeText### 2 | 3 | # workspace files are user-specific 4 | *.sublime-workspace 5 | 6 | # project files should be checked into the repository, unless a significant 7 | # proportion of contributors will probably not be using SublimeText 8 | # *.sublime-project 9 | 10 | 11 | ###Windows### 12 | 13 | # Windows image file caches 14 | Thumbs.db 15 | ehthumbs.db 16 | 17 | # Folder config file 18 | Desktop.ini 19 | 20 | # Recycle Bin used on file shares 21 | $RECYCLE.BIN/ 22 | 23 | # Windows Installer files 24 | *.cab 25 | *.msi 26 | *.msm 27 | *.msp 28 | 29 | 30 | ###OSX### 31 | 32 | .DS_Store 33 | .AppleDouble 34 | .LSOverride 35 | 36 | # Icon must ends with two \r. 37 | Icon 38 | 39 | # Thumbnails 40 | ._* 41 | 42 | # Files that might appear on external disk 43 | .Spotlight-V100 44 | .Trashes 45 | 46 | 47 | ###Node### 48 | 49 | # Logs 50 | logs 51 | *.log 52 | 53 | # Runtime data 54 | pids 55 | *.pid 56 | *.seed 57 | 58 | # Directory for instrumented libs generated by jscoverage/JSCover 59 | lib-cov 60 | 61 | # Coverage directory used by tools like istanbul 62 | coverage 63 | 64 | # Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files) 65 | .grunt 66 | 67 | # Compiled binary addons (http://nodejs.org/api/addons.html) 68 | build/Release 69 | 70 | # Dependency directory 71 | # Deployed apps should consider commenting this line out: 72 | # see https://npmjs.org/doc/faq.html#Should-I-check-my-node_modules-folder-into-git 73 | node_modules 74 | 75 | ### Bower ### 76 | public/components -------------------------------------------------------------------------------- /cm/keymap/emacs.js: -------------------------------------------------------------------------------- 1 | // TODO number prefixes 2 | (function() { 3 | // Really primitive kill-ring implementation. 4 | var killRing = []; 5 | function addToRing(str) { 6 | killRing.push(str); 7 | if (killRing.length > 50) killRing.shift(); 8 | } 9 | function getFromRing() { return killRing[killRing.length - 1] || ""; } 10 | function popFromRing() { if (killRing.length > 1) killRing.pop(); return getFromRing(); } 11 | 12 | CodeMirror.keyMap.emacs = { 13 | "Ctrl-X": function(cm) {cm.setOption("keyMap", "emacs-Ctrl-X");}, 14 | "Ctrl-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, 15 | "Ctrl-Alt-W": function(cm) {addToRing(cm.getSelection()); cm.replaceSelection("");}, 16 | "Alt-W": function(cm) {addToRing(cm.getSelection());}, 17 | "Ctrl-Y": function(cm) {cm.replaceSelection(getFromRing());}, 18 | "Alt-Y": function(cm) {cm.replaceSelection(popFromRing());}, 19 | "Ctrl-/": "undo", "Shift-Ctrl--": "undo", "Shift-Alt-,": "goDocStart", "Shift-Alt-.": "goDocEnd", 20 | "Ctrl-S": "findNext", "Ctrl-R": "findPrev", "Ctrl-G": "clearSearch", "Shift-Alt-5": "replace", 21 | "Ctrl-Z": "undo", "Cmd-Z": "undo", "Alt-/": "autocomplete", "Alt-V": "goPageUp", 22 | "Ctrl-J": "newlineAndIndent", "Enter": false, "Tab": "indentAuto", 23 | fallthrough: ["basic", "emacsy"] 24 | }; 25 | 26 | CodeMirror.keyMap["emacs-Ctrl-X"] = { 27 | "Ctrl-S": "save", "Ctrl-W": "save", "S": "saveAll", "F": "open", "U": "undo", "K": "close", 28 | auto: "emacs", nofallthrough: true 29 | }; 30 | })(); 31 | -------------------------------------------------------------------------------- /cm/theme/twilight.css: -------------------------------------------------------------------------------- 1 | .cm-s-twilight.CodeMirror { background: #141414; color: #f7f7f7; } /**/ 2 | .cm-s-twilight .CodeMirror-selected { background: #323232 !important; } /**/ 3 | 4 | .cm-s-twilight .CodeMirror-gutters { background: #222; border-right: 1px solid #aaa; } 5 | .cm-s-twilight .CodeMirror-linenumber { color: #aaa; } 6 | .cm-s-twilight .CodeMirror-cursor { border-left: 1px solid white !important; } 7 | 8 | .cm-s-twilight .cm-keyword { color: #f9ee98; } /**/ 9 | .cm-s-twilight .cm-atom { color: #FC0; } 10 | .cm-s-twilight .cm-number { color: #ca7841; } /**/ 11 | .cm-s-twilight .cm-def { color: #8DA6CE; } 12 | .cm-s-twilight span.cm-variable-2, .cm-s-twilight span.cm-tag { color: #607392; } /**/ 13 | .cm-s-twilight span.cm-variable-3, .cm-s-twilight span.cm-def { color: #607392; } /**/ 14 | .cm-s-twilight .cm-operator { color: #cda869; } /**/ 15 | .cm-s-twilight .cm-comment { color:#777; font-style:italic; font-weight:normal; } /**/ 16 | .cm-s-twilight .cm-string { color:#8f9d6a; font-style:italic; } /**/ 17 | .cm-s-twilight .cm-string-2 { color:#bd6b18 } /*?*/ 18 | .cm-s-twilight .cm-meta { background-color:#141414; color:#f7f7f7; } /*?*/ 19 | .cm-s-twilight .cm-error { border-bottom: 1px solid red; } 20 | .cm-s-twilight .cm-builtin { color: #cda869; } /*?*/ 21 | .cm-s-twilight .cm-tag { color: #997643; } /**/ 22 | .cm-s-twilight .cm-attribute { color: #d6bb6d; } /*?*/ 23 | .cm-s-twilight .cm-header { color: #FF6400; } 24 | .cm-s-twilight .cm-hr { color: #AEAEAE; } 25 | .cm-s-twilight .cm-link { color:#ad9361; font-style:italic; text-decoration:none; } /**/ 26 | 27 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/code.less: -------------------------------------------------------------------------------- 1 | // 2 | // Code (inline and blocK) 3 | // -------------------------------------------------- 4 | 5 | 6 | // Inline and block code styles 7 | code, 8 | pre { 9 | padding: 0 3px 2px; 10 | #font > #family > .monospace; 11 | font-size: @baseFontSize - 2; 12 | color: @grayDark; 13 | .border-radius(3px); 14 | } 15 | 16 | // Inline code 17 | code { 18 | padding: 2px 4px; 19 | color: #d14; 20 | background-color: #f7f7f9; 21 | border: 1px solid #e1e1e8; 22 | white-space: nowrap; 23 | } 24 | 25 | // Blocks of code 26 | pre { 27 | display: block; 28 | padding: (@baseLineHeight - 1) / 2; 29 | margin: 0 0 @baseLineHeight / 2; 30 | font-size: @baseFontSize - 1; // 14px to 13px 31 | line-height: @baseLineHeight; 32 | word-break: break-all; 33 | word-wrap: break-word; 34 | white-space: pre; 35 | white-space: pre-wrap; 36 | background-color: #f5f5f5; 37 | border: 1px solid #ccc; // fallback for IE7-8 38 | border: 1px solid rgba(0,0,0,.15); 39 | .border-radius(@baseBorderRadius); 40 | 41 | // Make prettyprint styles more spaced out for readability 42 | &.prettyprint { 43 | margin-bottom: @baseLineHeight; 44 | } 45 | 46 | // Account for some code outputs that place code tags in pre tags 47 | code { 48 | padding: 0; 49 | color: inherit; 50 | white-space: pre; 51 | white-space: pre-wrap; 52 | background-color: transparent; 53 | border: 0; 54 | } 55 | } 56 | 57 | // Enable scrollable blocks of code 58 | .pre-scrollable { 59 | max-height: 340px; 60 | overflow-y: scroll; 61 | } -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/services/LessLoader.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .service('LessLoader', [ 4 | '$q', 5 | '$http', 6 | '$window', 7 | '$timeout', 8 | function($q, $http, $window, $timeout) { 9 | var _loadedVersionsCache = {}; 10 | var _lessBasePath = "/javascripts/less/less-{version}.js"; 11 | 12 | function _eval(str) { 13 | /* jshint evil: true */ 14 | $window['eval'].call($window, str); 15 | } 16 | 17 | _.extend(this, { 18 | load: function(version, beta) { 19 | if ($window.less) delete $window.less; 20 | 21 | version = beta ? version + "-beta": version; 22 | 23 | var scriptUrl = _lessBasePath.replace("{version}", version); 24 | var deferred = $q.defer(); 25 | 26 | // Don't make the XHR if we have the script in memory 27 | if (version in _loadedVersionsCache) { 28 | _eval(_loadedVersionsCache[version]); 29 | $timeout(function() { deferred.resolve(); }, 1, false); 30 | return deferred.promise; 31 | } 32 | 33 | $http.get(scriptUrl) 34 | .success(function(data) { 35 | _eval(data); 36 | _loadedVersionsCache[version] = data; 37 | deferred.resolve(); 38 | }) 39 | .error(function() { 40 | $window.alert('There was a problem loading the selected Less file ' + version); 41 | deferred.reject(); 42 | }); 43 | 44 | return deferred.promise; 45 | }, 46 | 47 | isLoaded: function() { 48 | return !!$window.less; 49 | } 50 | }); 51 | } 52 | ]); -------------------------------------------------------------------------------- /cm/demo/changemode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Mode-Changing Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 |

CodeMirror: Mode-Changing demo

18 | 19 |
26 | 27 |

On changes to the content of the above editor, a (crude) script 28 | tries to auto-detect the language used, and switches the editor to 29 | either JavaScript or Scheme mode based on that.

30 | 31 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/controllers/Less2CssCtrl.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .controller('Less2CssCtrl', [ 4 | '$scope', 5 | 'LessLoader', 6 | 'LessOptions', 7 | 'LessCompiler', 8 | function($scope, LessLoader, LessOptions, LessCompiler) { 9 | var _opts; 10 | // Start req for options 11 | LessOptions.request.then(setupOptions); 12 | 13 | function setupOptions() { 14 | _opts = $scope.opts = LessOptions.options; 15 | updateOptions(_opts); 16 | 17 | // Setup watchers 18 | $scope.$watch('lessInput', compileLess); 19 | $scope.$watch('opts.selectedVersion', loadLess); 20 | $scope.$watch('opts', updateOptions, true); 21 | } 22 | 23 | // Set defaults 24 | _.extend($scope, { 25 | lessInput: LessCompiler.getCache(), 26 | cssOutput: '', 27 | loading: false, 28 | compileError: false 29 | }); 30 | 31 | function updateOptions(opts) { 32 | LessCompiler.updateOptions(opts); 33 | LessOptions.setCache(opts); 34 | compileLess(); 35 | } 36 | 37 | // Private fns 38 | function loadLess() { 39 | $scope.loading = true; 40 | 41 | LessLoader 42 | .load(_opts.selectedVersion, _opts.version.type === 'pre') 43 | .then(function() { 44 | LessCompiler.initLess(); 45 | compileLess(); 46 | $scope.loading = false; 47 | }); 48 | } 49 | 50 | function compileLess() { 51 | $scope.$safeApply(function() { 52 | _.extend($scope, { 53 | cssOutput: LessCompiler.compileLess($scope.lessInput), 54 | compileError: LessCompiler.error 55 | }); 56 | }); 57 | } 58 | } 59 | ]); -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/alerts.less: -------------------------------------------------------------------------------- 1 | // 2 | // Alerts 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base styles 7 | // ------------------------- 8 | 9 | .alert { 10 | padding: 8px 35px 8px 14px; 11 | margin-bottom: @baseLineHeight; 12 | text-shadow: 0 1px 0 rgba(255,255,255,.5); 13 | background-color: @warningBackground; 14 | border: 1px solid @warningBorder; 15 | .border-radius(@baseBorderRadius); 16 | } 17 | .alert, 18 | .alert h4 { 19 | // Specified for the h4 to prevent conflicts of changing @headingsColor 20 | color: @warningText; 21 | } 22 | .alert h4 { 23 | margin: 0; 24 | } 25 | 26 | // Adjust close link position 27 | .alert .close { 28 | position: relative; 29 | top: -2px; 30 | right: -21px; 31 | line-height: @baseLineHeight; 32 | } 33 | 34 | 35 | // Alternate styles 36 | // ------------------------- 37 | 38 | .alert-success { 39 | background-color: @successBackground; 40 | border-color: @successBorder; 41 | color: @successText; 42 | } 43 | .alert-success h4 { 44 | color: @successText; 45 | } 46 | .alert-danger, 47 | .alert-error { 48 | background-color: @errorBackground; 49 | border-color: @errorBorder; 50 | color: @errorText; 51 | } 52 | .alert-danger h4, 53 | .alert-error h4 { 54 | color: @errorText; 55 | } 56 | .alert-info { 57 | background-color: @infoBackground; 58 | border-color: @infoBorder; 59 | color: @infoText; 60 | } 61 | .alert-info h4 { 62 | color: @infoText; 63 | } 64 | 65 | 66 | // Block alerts 67 | // ------------------------- 68 | 69 | .alert-block { 70 | padding-top: 14px; 71 | padding-bottom: 14px; 72 | } 73 | .alert-block > p, 74 | .alert-block > ul { 75 | margin-bottom: 0; 76 | } 77 | .alert-block p + p { 78 | margin-top: 5px; 79 | } 80 | -------------------------------------------------------------------------------- /cm/demo/variableheight.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Variable Height Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 |

CodeMirror: Variable Height Demo

20 | 21 |
44 | 51 | 52 | 53 | -------------------------------------------------------------------------------- /cm/demo/visibletabs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Visible tabs demo 6 | 7 | 8 | 9 | 10 | 11 | 19 | 20 | 21 |

CodeMirror: Visible tabs demo

22 | 23 |
38 | 39 |

Tabs inside the editor are spans with the 40 | class cm-tab, and can be styled. 41 | 42 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /cm/demo/marker.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Breakpoint Demo 6 | 7 | 8 | 9 | 10 | 11 | 16 | 17 | 18 |

CodeMirror: Breakpoint demo

19 | 20 |
37 | 38 |

Click the line-number gutter to add or remove 'breakpoints'.

39 | 40 | 57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/bootstrap.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * Bootstrap v2.3.2 3 | * 4 | * Copyright 2012 Twitter, Inc 5 | * Licensed under the Apache License v2.0 6 | * http://www.apache.org/licenses/LICENSE-2.0 7 | * 8 | * Designed and built with all the love in the world @twitter by @mdo and @fat. 9 | */ 10 | 11 | // Core variables and mixins 12 | @import "variables.less"; // Modify this for custom colors, font-sizes, etc 13 | @import "mixins.less"; 14 | 15 | // CSS Reset 16 | @import "reset.less"; 17 | 18 | // Grid system and page structure 19 | @import "scaffolding.less"; 20 | @import "grid.less"; 21 | @import "layouts.less"; 22 | 23 | // Base CSS 24 | @import "type.less"; 25 | @import "code.less"; 26 | @import "forms.less"; 27 | // @import "tables.less"; 28 | 29 | // Components: common 30 | @import "sprites.less"; 31 | @import "dropdowns.less"; 32 | @import "wells.less"; 33 | // @import "component-animations.less"; 34 | @import "close.less"; 35 | 36 | // Components: Buttons & Alerts 37 | @import "buttons.less"; 38 | @import "button-groups.less"; 39 | @import "alerts.less"; // Note: alerts share common CSS with buttons and thus have styles in buttons.less 40 | 41 | // Components: Nav 42 | // @import "navs.less"; 43 | // @import "navbar.less"; 44 | // @import "breadcrumbs.less"; 45 | // @import "pagination.less"; 46 | // @import "pager.less"; 47 | 48 | // Components: Popovers 49 | // @import "modals.less"; 50 | // @import "tooltip.less"; 51 | // @import "popovers.less"; 52 | 53 | // Components: Misc 54 | // @import "thumbnails.less"; 55 | // @import "media.less"; 56 | // @import "labels-badges.less"; 57 | // @import "progress-bars.less"; 58 | // @import "accordion.less"; 59 | // @import "carousel.less"; 60 | // @import "hero-unit.less"; 61 | 62 | // Utility classes 63 | @import "utilities.less"; // Has to be last to override when necessary -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/responsive-utilities.less: -------------------------------------------------------------------------------- 1 | // 2 | // Responsive: Utility classes 3 | // -------------------------------------------------- 4 | 5 | 6 | // IE10 Metro responsive 7 | // Required for Windows 8 Metro split-screen snapping with IE10 8 | // Source: http://timkadlec.com/2012/10/ie10-snap-mode-and-responsive-design/ 9 | @-ms-viewport{ 10 | width: device-width; 11 | } 12 | 13 | // Hide from screenreaders and browsers 14 | // Credit: HTML5 Boilerplate 15 | .hidden { 16 | display: none; 17 | visibility: hidden; 18 | } 19 | 20 | // Visibility utilities 21 | 22 | // For desktops 23 | .visible-phone { display: none !important; } 24 | .visible-tablet { display: none !important; } 25 | .hidden-phone { } 26 | .hidden-tablet { } 27 | .hidden-desktop { display: none !important; } 28 | .visible-desktop { display: inherit !important; } 29 | 30 | // Tablets & small desktops only 31 | @media (min-width: 768px) and (max-width: 979px) { 32 | // Hide everything else 33 | .hidden-desktop { display: inherit !important; } 34 | .visible-desktop { display: none !important ; } 35 | // Show 36 | .visible-tablet { display: inherit !important; } 37 | // Hide 38 | .hidden-tablet { display: none !important; } 39 | } 40 | 41 | // Phones only 42 | @media (max-width: 767px) { 43 | // Hide everything else 44 | .hidden-desktop { display: inherit !important; } 45 | .visible-desktop { display: none !important; } 46 | // Show 47 | .visible-phone { display: inherit !important; } // Use inherit to restore previous behavior 48 | // Hide 49 | .hidden-phone { display: none !important; } 50 | } 51 | 52 | // Print utilities 53 | .visible-print { display: none !important; } 54 | .hidden-print { } 55 | 56 | @media print { 57 | .visible-print { display: inherit !important; } 58 | .hidden-print { display: none !important; } 59 | } 60 | -------------------------------------------------------------------------------- /app.js: -------------------------------------------------------------------------------- 1 | var http = require('http'); 2 | var routes = require('./routes'); 3 | var express = require('express'); 4 | 5 | var app = express(); 6 | http.createServer(app); 7 | 8 | app.locals.env = app.get('env'); 9 | app.locals.scripts = (require('./express/app-scripts')(process.cwd())).getScriptSrc(app.get('env')); 10 | 11 | // Perform canonicalization 12 | app.use(function(req, res, next) { 13 | var host = req.headers.host; 14 | 15 | if (host === 'less2css.org') { 16 | next(); // Quick next for canonical 17 | } else if (host === 'www.less2css.org') { 18 | res.redirect(301, 'http://less2css.org' + req.url); 19 | } else { 20 | next(); 21 | } 22 | }); 23 | 24 | // Begin config 25 | app.configure('all', function() { 26 | app.set('port', '3000'); 27 | app.set('views', __dirname + '/views'); 28 | app.set('view engine', 'jade'); 29 | app.use(express.compress()); 30 | app.use(express.logger()); 31 | app.use(express.cookieParser()); 32 | app.use(express.bodyParser()); 33 | app.use(express.methodOverride()); 34 | app.use(app.router); 35 | app.use(express.static(__dirname + '/public')); 36 | }); 37 | 38 | app.configure('development', function() { 39 | app.use(express.errorHandler({ 40 | showStack: true, 41 | dumpExceptions: true 42 | })); 43 | }); 44 | 45 | app.configure('production', function() { 46 | app.use(express.errorHandler()); 47 | }); 48 | 49 | app.use(routes.four_oh_four); 50 | 51 | // Begin Routes 52 | app.get('/', routes.home); 53 | app.get('/less-options', routes.less_options); 54 | 55 | // app.get('/logout', function(req, res) { 56 | // req.logout(); 57 | // res.redirect('/'); 58 | // }); 59 | 60 | // app.get('/share/:id([A-Za-z0-9]{1,6})', routes.share); 61 | // app.post('/compile', routes.compile); 62 | 63 | // Init 64 | app.listen(app.get('port'), function(){ 65 | console.log("Server started on port " + app.get('port') + ' in ' + app.get('env') + ' mode.'); 66 | }); 67 | -------------------------------------------------------------------------------- /cm/demo/multiplex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Multiplexing Parser Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 |

CodeMirror: Multiplexing Parser Demo

19 | 20 |
33 | 34 | 50 | 51 |

Demonstration of a multiplexing mode, which, at certain 52 | boundary strings, switches to one or more inner modes. The out 53 | (HTML) mode does not get fed the content of the << 54 | >> blocks. See 55 | the manual and 56 | the source for more 57 | information.

58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/controllers/OptionsCtrl.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .controller('OptionsCtrl', [ 4 | '$scope', 5 | '$rootScope', 6 | 'LessOptions', 7 | function($scope, $rootScope, LessOptions) { 8 | var opts = $scope.opts = LessOptions.options; 9 | 10 | LessOptions.request.then(setupOptions); 11 | 12 | _.extend($scope, { 13 | resetOptions: ['Options', 'Editor', 'Both'], 14 | 15 | toggleOption: function(model) { 16 | opts[model] = !opts[model]; 17 | }, 18 | 19 | toggleTxt: function(model) { 20 | return opts[model] ? 'Enabled' : 'Disabled'; 21 | }, 22 | 23 | reset: function(val) { 24 | $rootScope.$broadcast('Reset:' + val); 25 | } 26 | }); 27 | 28 | $scope.lessReset = $scope.resetOptions[0]; 29 | 30 | function setupOptions() { 31 | // Copy defaults to opts 32 | _.defaults(opts, opts.options); 33 | opts.lineNumbers = opts.lineNumbers || opts.lineNumberOptions[0].value; 34 | setupVersion(); 35 | } 36 | 37 | function setupVersion() { 38 | // Select current version 39 | opts.selectedVersion = opts.selectedVersion || _.find(opts.versions, function (version) { 40 | return version.type === 'current'; 41 | }).number; 42 | } 43 | 44 | function updateLineNumbers() { 45 | opts.dumpLineNumbers = opts.lineNumbersEnabled && opts.lineNumbers ? opts.lineNumbers : false; 46 | } 47 | 48 | function updateRootPath() { 49 | opts.rootpath = opts.rootPathEnabled && opts.rootpathText ? opts.rootpathText : false; 50 | } 51 | 52 | function updateVersion(version) { 53 | opts.version = _.find(opts.versions, function(ver) { return ver.number === version; }); 54 | } 55 | 56 | $scope.$watch('opts.lineNumbers+opts.lineNumbersEnabled', updateLineNumbers); 57 | $scope.$watch('opts.rootpathText+opts.rootpath', updateRootPath); 58 | $scope.$watch('opts.selectedVersion', updateVersion); 59 | } 60 | ]); 61 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/tooltip.less: -------------------------------------------------------------------------------- 1 | // 2 | // Tooltips 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base class 7 | .tooltip { 8 | position: absolute; 9 | z-index: @zindexTooltip; 10 | display: block; 11 | visibility: visible; 12 | font-size: 11px; 13 | line-height: 1.4; 14 | .opacity(0); 15 | &.in { .opacity(80); } 16 | &.top { margin-top: -3px; padding: 5px 0; } 17 | &.right { margin-left: 3px; padding: 0 5px; } 18 | &.bottom { margin-top: 3px; padding: 5px 0; } 19 | &.left { margin-left: -3px; padding: 0 5px; } 20 | } 21 | 22 | // Wrapper for the tooltip content 23 | .tooltip-inner { 24 | max-width: 200px; 25 | padding: 8px; 26 | color: @tooltipColor; 27 | text-align: center; 28 | text-decoration: none; 29 | background-color: @tooltipBackground; 30 | .border-radius(@baseBorderRadius); 31 | } 32 | 33 | // Arrows 34 | .tooltip-arrow { 35 | position: absolute; 36 | width: 0; 37 | height: 0; 38 | border-color: transparent; 39 | border-style: solid; 40 | } 41 | .tooltip { 42 | &.top .tooltip-arrow { 43 | bottom: 0; 44 | left: 50%; 45 | margin-left: -@tooltipArrowWidth; 46 | border-width: @tooltipArrowWidth @tooltipArrowWidth 0; 47 | border-top-color: @tooltipArrowColor; 48 | } 49 | &.right .tooltip-arrow { 50 | top: 50%; 51 | left: 0; 52 | margin-top: -@tooltipArrowWidth; 53 | border-width: @tooltipArrowWidth @tooltipArrowWidth @tooltipArrowWidth 0; 54 | border-right-color: @tooltipArrowColor; 55 | } 56 | &.left .tooltip-arrow { 57 | top: 50%; 58 | right: 0; 59 | margin-top: -@tooltipArrowWidth; 60 | border-width: @tooltipArrowWidth 0 @tooltipArrowWidth @tooltipArrowWidth; 61 | border-left-color: @tooltipArrowColor; 62 | } 63 | &.bottom .tooltip-arrow { 64 | top: 0; 65 | left: 50%; 66 | margin-left: -@tooltipArrowWidth; 67 | border-width: 0 @tooltipArrowWidth @tooltipArrowWidth; 68 | border-bottom-color: @tooltipArrowColor; 69 | } 70 | } 71 | -------------------------------------------------------------------------------- /cm/demo/mustache.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Overlay Parser Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 |

CodeMirror: Overlay Parser Demo

19 | 20 |
31 | 32 | 51 | 52 |

Demonstration of a mode that parses HTML, highlighting 53 | the Mustache templating 54 | directives inside of it by using the code 55 | in overlay.js. View 56 | source to see the 15 lines of code needed to accomplish this.

57 | 58 | 59 | 60 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/services/LessOptions.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .service('LessOptions', [ 4 | '$q', 5 | '$http', 6 | 'Stor', 7 | function LessOptions($q, $http, Stor) { 8 | var self = this; 9 | var day = 86400000; 10 | var deferred = $q.defer(); 11 | var promise = deferred.promise.then(mergeOptions); 12 | var storageTTL = day * 30; 13 | var stor = Stor('LessOptions', storageTTL); 14 | var cache = stor.get(); 15 | 16 | // Check if we have cache and defaults. Otherwise get options 17 | if (!cache || !cache.defaults) { 18 | $http.get('/less-options').success(function(data) { 19 | deferred.resolve(data); 20 | // Set cache defaults 21 | stor.set({ defaults: data }); 22 | }); 23 | } else if (needsOptionsUpdate(cache)) { 24 | $http.get('/less-options').success(function(data) { 25 | // Overwrite defaults and lastUpdate 26 | _.extend(cache, { defaults: data, lastUpdate: getNow() }); 27 | // Any previously non-existent defaults before default options 28 | _.defaults(cache.options, cache.defaults); 29 | // Make an exception for new versions of less 30 | cache.options.versions = cache.defaults.versions; 31 | // Save cache and resolve 32 | stor.set(cache); 33 | deferred.resolve(cache.options); 34 | }); 35 | } else { 36 | // If options were saved, use those, otherwise use defaults. 37 | deferred.resolve(cache.options || cache.defaults); 38 | } 39 | 40 | _.extend(self, { 41 | options: {}, 42 | request: promise, 43 | setCache: function(data) { 44 | var newOpts = stor.get(); 45 | newOpts.options = data; 46 | stor.set(newOpts); 47 | } 48 | }); 49 | 50 | function needsOptionsUpdate(obj) { 51 | return !obj.lastUpdate || (obj.lastUpdate + day) < getNow(); 52 | } 53 | 54 | function getNow() { 55 | return new Date().getTime(); 56 | } 57 | 58 | function mergeOptions(data) { 59 | _.extend(self.options, data); 60 | } 61 | } 62 | ]); -------------------------------------------------------------------------------- /cm/demo/emacs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Emacs bindings demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 15 | 16 | 17 |

CodeMirror: Emacs bindings demo

18 | 19 |
34 | 35 |

The emacs keybindings are enabled by 36 | including keymap/emacs.js and setting 37 | the keyMap option to "emacs". Because 38 | CodeMirror's internal API is quite different from Emacs, they are only 39 | a loose approximation of actual emacs bindings, though.

40 | 41 |

Also note that a lot of browsers disallow certain keys from being 42 | captured. For example, Chrome blocks both Ctrl-W and Ctrl-N, with the 43 | result that idiomatic use of Emacs keys will constantly close your tab 44 | or open a new window.

45 | 46 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /cm/demo/runmode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Mode Runner Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |

CodeMirror: Mode Runner Demo

14 | 15 |
21 | 22 |

23 | 
24 |     
30 | 
31 |     

Running a CodeMirror mode outside of the editor. 32 | The CodeMirror.runMode function, defined 33 | in lib/runmode.js takes the following arguments:

34 | 35 |
36 |
text (string)
37 |
The document to run through the highlighter.
38 |
mode (mode spec)
39 |
The mode to use (must be loaded as normal).
40 |
output (function or DOM node)
41 |
If this is a function, it will be called for each token with 42 | two arguments, the token's text and the token's style class (may 43 | be null for unstyled tokens). If it is a DOM node, 44 | the tokens will be converted to span elements as in 45 | an editor, and inserted into the node 46 | (through innerHTML).
47 |
48 | 49 | 50 | 51 | -------------------------------------------------------------------------------- /cm/theme/lesser-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | http://lesscss.org/ dark theme 3 | Ported to CodeMirror by Peter Kroon 4 | */ 5 | .cm-s-lesser-dark { 6 | line-height: 1.3em; 7 | } 8 | .cm-s-lesser-dark { 9 | font-family: 'Bitstream Vera Sans Mono', 'DejaVu Sans Mono', 'Monaco', Courier, monospace !important; 10 | } 11 | 12 | .cm-s-lesser-dark.CodeMirror { background: #262626; color: #EBEFE7; text-shadow: 0 -1px 1px #262626; } 13 | .cm-s-lesser-dark div.CodeMirror-selected {background: #45443B !important;} /* 33322B*/ 14 | .cm-s-lesser-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 15 | .cm-s-lesser-dark pre { padding: 0 8px; }/*editable code holder*/ 16 | 17 | div.CodeMirror span.CodeMirror-matchingbracket { color: #7EFC7E; }/*65FC65*/ 18 | 19 | .cm-s-lesser-dark .CodeMirror-gutters { background: #262626; border-right:1px solid #aaa; } 20 | .cm-s-lesser-dark .CodeMirror-linenumber { color: #777; } 21 | 22 | .cm-s-lesser-dark span.cm-keyword { color: #599eff; } 23 | .cm-s-lesser-dark span.cm-atom { color: #C2B470; } 24 | .cm-s-lesser-dark span.cm-number { color: #B35E4D; } 25 | .cm-s-lesser-dark span.cm-def {color: white;} 26 | .cm-s-lesser-dark span.cm-variable { color:#D9BF8C; } 27 | .cm-s-lesser-dark span.cm-variable-2 { color: #669199; } 28 | .cm-s-lesser-dark span.cm-variable-3 { color: white; } 29 | .cm-s-lesser-dark span.cm-property {color: #92A75C;} 30 | .cm-s-lesser-dark span.cm-operator {color: #92A75C;} 31 | .cm-s-lesser-dark span.cm-comment { color: #666; } 32 | .cm-s-lesser-dark span.cm-string { color: #BCD279; } 33 | .cm-s-lesser-dark span.cm-string-2 {color: #f50;} 34 | .cm-s-lesser-dark span.cm-meta { color: #738C73; } 35 | .cm-s-lesser-dark span.cm-error { color: #9d1e15; } 36 | .cm-s-lesser-dark span.cm-qualifier {color: #555;} 37 | .cm-s-lesser-dark span.cm-builtin { color: #ff9e59; } 38 | .cm-s-lesser-dark span.cm-bracket { color: #EBEFE7; } 39 | .cm-s-lesser-dark span.cm-tag { color: #669199; } 40 | .cm-s-lesser-dark span.cm-attribute {color: #00c;} 41 | .cm-s-lesser-dark span.cm-header {color: #a0a;} 42 | .cm-s-lesser-dark span.cm-quote {color: #090;} 43 | .cm-s-lesser-dark span.cm-hr {color: #999;} 44 | .cm-s-lesser-dark span.cm-link {color: #00c;} 45 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/labels-badges.less: -------------------------------------------------------------------------------- 1 | // 2 | // Labels and badges 3 | // -------------------------------------------------- 4 | 5 | 6 | // Base classes 7 | .label, 8 | .badge { 9 | display: inline-block; 10 | padding: 2px 4px; 11 | font-size: @baseFontSize * .846; 12 | font-weight: bold; 13 | line-height: 14px; // ensure proper line-height if floated 14 | color: @white; 15 | vertical-align: baseline; 16 | white-space: nowrap; 17 | text-shadow: 0 -1px 0 rgba(0,0,0,.25); 18 | background-color: @grayLight; 19 | } 20 | // Set unique padding and border-radii 21 | .label { 22 | .border-radius(3px); 23 | } 24 | .badge { 25 | padding-left: 9px; 26 | padding-right: 9px; 27 | .border-radius(9px); 28 | } 29 | 30 | // Empty labels/badges collapse 31 | .label, 32 | .badge { 33 | &:empty { 34 | display: none; 35 | } 36 | } 37 | 38 | // Hover/focus state, but only for links 39 | a { 40 | &.label:hover, 41 | &.label:focus, 42 | &.badge:hover, 43 | &.badge:focus { 44 | color: @white; 45 | text-decoration: none; 46 | cursor: pointer; 47 | } 48 | } 49 | 50 | // Colors 51 | // Only give background-color difference to links (and to simplify, we don't qualifty with `a` but [href] attribute) 52 | .label, 53 | .badge { 54 | // Important (red) 55 | &-important { background-color: @errorText; } 56 | &-important[href] { background-color: darken(@errorText, 10%); } 57 | // Warnings (orange) 58 | &-warning { background-color: @orange; } 59 | &-warning[href] { background-color: darken(@orange, 10%); } 60 | // Success (green) 61 | &-success { background-color: @successText; } 62 | &-success[href] { background-color: darken(@successText, 10%); } 63 | // Info (turquoise) 64 | &-info { background-color: @infoText; } 65 | &-info[href] { background-color: darken(@infoText, 10%); } 66 | // Inverse (black) 67 | &-inverse { background-color: @grayDark; } 68 | &-inverse[href] { background-color: darken(@grayDark, 10%); } 69 | } 70 | 71 | // Quick fix for labels/badges in buttons 72 | .btn { 73 | .label, 74 | .badge { 75 | position: relative; 76 | top: -1px; 77 | } 78 | } 79 | .btn-mini { 80 | .label, 81 | .badge { 82 | top: 0; 83 | } 84 | } 85 | -------------------------------------------------------------------------------- /cm/demo/vim.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Vim bindings demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 18 | 19 | 20 |

CodeMirror: Vim bindings demo

21 | 22 |
37 | 38 |
41 | 42 |

The vim keybindings are enabled by 43 | including keymap/vim.js and setting 44 | the keyMap option to "vim". Because 45 | CodeMirror's internal API is quite different from Vim, they are only 46 | a loose approximation of actual vim bindings, though.

47 | 48 | 63 | 64 | 65 | 66 | -------------------------------------------------------------------------------- /express/app-scripts.js: -------------------------------------------------------------------------------- 1 | /* jshint undef: false */ 2 | 3 | function Scripts(basePath) { 4 | if (!(this instanceof Scripts)) return new Scripts(basePath); 5 | 6 | this.basePath = basePath; 7 | this.jsPath = basePath + '/public/javascripts'; 8 | } 9 | 10 | Scripts.prototype = { 11 | production: function() { 12 | var js = this.jsPath; 13 | 14 | return { 15 | vendor: [ js + '/vendor.min.js' ], 16 | app: [ js + '/less2css.min.js' ] 17 | }; 18 | }, 19 | 20 | development: function() { 21 | var js = this.jsPath; 22 | 23 | return { 24 | vendor: [ 25 | js + '/vendor/angular.js', 26 | js + '/vendor/lodash.js', 27 | js + '/vendor/cm/codemirror.js', 28 | js + '/vendor/cm/addon/edit/closebrackets.js', 29 | js + '/vendor/cm/addon/edit/matchbrackets.js', 30 | js + '/vendor/cm/mode/less/less.js' 31 | ], 32 | app: [ 33 | js + '/src/base-extenders.js', 34 | js + '/src/lodash-extenders.js', 35 | js + '/src/Stor/Stor.js', 36 | js + '/src/Stor/angular-stor.js', 37 | js + '/src/TransitionHelper/TransitionHelper.js', 38 | js + '/src/Less2Css/less2css.js', 39 | js + '/src/Less2Css/services/LessLoader.js', 40 | js + '/src/Less2Css/services/LessOptions.js', 41 | js + '/src/Less2Css/services/LessCompiler.js', 42 | js + '/src/Less2Css/directives/lessEditor.js', 43 | js + '/src/Less2Css/directives/drawer.js', 44 | js + '/src/Less2Css/controllers/AppCtrl.js', 45 | js + '/src/Less2Css/controllers/OptionsCtrl.js', 46 | js + '/src/Less2Css/controllers/Less2CssCtrl.js' 47 | ] 48 | }; 49 | }, 50 | 51 | testUnit: function() { 52 | var dev = this.development(); 53 | 54 | var testUnit = [].concat(dev.vendor, dev.app); 55 | testUnit.push(this.basePath + '/test/unit/**/*.spec.js'); 56 | 57 | return testUnit; 58 | }, 59 | 60 | getScriptSrc: function(env) { 61 | var scripts = this[env](); 62 | var combined = scripts.vendor.concat(scripts.app); 63 | var len = combined.length; 64 | var i = 0; 65 | 66 | while (i < len) { 67 | combined[i] = combined[i].replace(this.jsPath, '/javascripts'); 68 | i++; 69 | } 70 | 71 | return combined; 72 | } 73 | }; 74 | 75 | module.exports = Scripts; -------------------------------------------------------------------------------- /cm/doc/reporting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Reporting Bugs 6 | 7 | 8 | 9 | 10 | 11 | 12 |

{ } CodeMirror

13 | 14 |
15 | 16 |
17 | /* Reporting bugs
18 |    effectively */
19 | 
20 |
21 | 22 |
23 | 24 |

So you found a problem in CodeMirror. By all means, report it! Bug 25 | reports from users are the main drive behind improvements to 26 | CodeMirror. But first, please read over these points:

27 | 28 |
    29 |
  1. CodeMirror is maintained by volunteers. They don't owe you 30 | anything, so be polite. Reports with an indignant or belligerent 31 | tone tend to be moved to the bottom of the pile.
  2. 32 | 33 |
  3. Include information about the browser in which the 34 | problem occurred. Even if you tested several browsers, and 35 | the problem occurred in all of them, mention this fact in the bug 36 | report. Also include browser version numbers and the operating 37 | system that you're on.
  4. 38 | 39 |
  5. Mention which release of CodeMirror you're using. Preferably, 40 | try also with the current development snapshot, to ensure the 41 | problem has not already been fixed.
  6. 42 | 43 |
  7. Mention very precisely what went wrong. "X is broken" is not a 44 | good bug report. What did you expect to happen? What happened 45 | instead? Describe the exact steps a maintainer has to take to make 46 | the problem occur. We can not fix something that we can not 47 | observe.
  8. 48 | 49 |
  9. If the problem can not be reproduced in any of the demos 50 | included in the CodeMirror distribution, please provide an HTML 51 | document that demonstrates the problem. The best way to do this is 52 | to go to jsbin.com, enter 53 | it there, press save, and include the resulting link in your bug 54 | report.
  10. 55 |
56 | 57 |
58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/modals.less: -------------------------------------------------------------------------------- 1 | // 2 | // Modals 3 | // -------------------------------------------------- 4 | 5 | // Background 6 | .modal-backdrop { 7 | position: fixed; 8 | top: 0; 9 | right: 0; 10 | bottom: 0; 11 | left: 0; 12 | z-index: @zindexModalBackdrop; 13 | background-color: @black; 14 | // Fade for backdrop 15 | &.fade { opacity: 0; } 16 | } 17 | 18 | .modal-backdrop, 19 | .modal-backdrop.fade.in { 20 | .opacity(80); 21 | } 22 | 23 | // Base modal 24 | .modal { 25 | position: fixed; 26 | top: 10%; 27 | left: 50%; 28 | z-index: @zindexModal; 29 | width: 560px; 30 | margin-left: -280px; 31 | background-color: @white; 32 | border: 1px solid #999; 33 | border: 1px solid rgba(0,0,0,.3); 34 | *border: 1px solid #999; /* IE6-7 */ 35 | .border-radius(6px); 36 | .box-shadow(0 3px 7px rgba(0,0,0,0.3)); 37 | .background-clip(padding-box); 38 | // Remove focus outline from opened modal 39 | outline: none; 40 | 41 | &.fade { 42 | .transition(e('opacity .3s linear, top .3s ease-out')); 43 | top: -25%; 44 | } 45 | &.fade.in { top: 10%; } 46 | } 47 | .modal-header { 48 | padding: 9px 15px; 49 | border-bottom: 1px solid #eee; 50 | // Close icon 51 | .close { margin-top: 2px; } 52 | // Heading 53 | h3 { 54 | margin: 0; 55 | line-height: 30px; 56 | } 57 | } 58 | 59 | // Body (where all modal content resides) 60 | .modal-body { 61 | position: relative; 62 | overflow-y: auto; 63 | max-height: 400px; 64 | padding: 15px; 65 | } 66 | // Remove bottom margin if need be 67 | .modal-form { 68 | margin-bottom: 0; 69 | } 70 | 71 | // Footer (for actions) 72 | .modal-footer { 73 | padding: 14px 15px 15px; 74 | margin-bottom: 0; 75 | text-align: right; // right align buttons 76 | background-color: #f5f5f5; 77 | border-top: 1px solid #ddd; 78 | .border-radius(0 0 6px 6px); 79 | .box-shadow(inset 0 1px 0 @white); 80 | .clearfix(); // clear it in case folks use .pull-* classes on buttons 81 | 82 | // Properly space out buttons 83 | .btn + .btn { 84 | margin-left: 5px; 85 | margin-bottom: 0; // account for input[type="submit"] which gets the bottom margin like all other inputs 86 | } 87 | // but override that for button groups 88 | .btn-group .btn + .btn { 89 | margin-left: -1px; 90 | } 91 | // and override it for block buttons as well 92 | .btn-block + .btn-block { 93 | margin-left: 0; 94 | } 95 | } 96 | -------------------------------------------------------------------------------- /Readme.md: -------------------------------------------------------------------------------- 1 | # LESS2CSS | Live LESS Preview 2 | 3 | [LESS](http://lesscss.org/) is a popular CSS pre-processor. Used on the [Twitter Bootstrap](https://twitter.gitub.com/bootstrap/) project and on many others, LESS makes CSS more powerful by giving designers and developers access to [variables](http://lesscss.org/#-variables), [mixins](http://lesscss.org/#-mixins), [functions](http://lesscss.org/#-functions), [string interpolation](http://lesscss.org/#-string-interpolation), [imports](http://lesscss.org/#-importing), and many other features. 4 | 5 | ## Debugging 6 | 7 | LESS Previewer was cooked us as a way to visualize LESS output quickly by running it directly through the LESS processor. This allows you to test various version of LESS and their support (or lack thereof) of the syntax you are using. 8 | 9 | Because LESS has very different levels of support for certain syntax depending on the version, it's often nice to be able to test this directly. 10 | 11 | For example selector interpolation like this only works in 1.3.1+ 12 | 13 | ```less 14 | @mySelector: home-base; 15 | 16 | .@{mySelector} { 17 | display: block; 18 | } 19 | ``` 20 | 21 | ## Contributing 22 | 23 | ### Style 24 | 25 | If needed a style-guide will be created for contributors. In the meantime, if you'd like to contribute, please take care to follow the general style of the project. 26 | 27 | ### Requirements for building & running 28 | 29 | - [Node.js](http://nodejs.org/) 30 | - [MongoDB](http://www.mongodb.org/) (coming soon) 31 | 32 | ### Building 33 | 34 | 1. Install [grunt-cli](https://github.com/gruntjs/grunt/wiki/Getting-started): `$ [sudo] npm install -g grunt-cli`. 35 | 2. Install [express](http://expressjs.com/): `$ [sudo] npm install -g express` 36 | 3. Install dependencies *(from root project folder)*: `$ npm install` 37 | 4. Run [Grunt](http://gruntjs.com/) *(from root project folder)*: `$ grunt` 38 | 5. Start the app: `$ npm start`. This will start the app on http://localhost:3000/. [Nodemon](https://github.com/remy/nodemon) will restart the server automatically when it detects a change. 39 | 6. Open a new terminal tab or window and start the [watcher](https://github.com/gruntjs/grunt-contrib-watch) task: `$ grunt watch`. This will compile coffee-script to js, run [jshint](http://jshint.com/) on the output, and [minify](https://github.com/mishoo/UglifyJS) the files, and run all unit tests. 40 | 41 | --- 42 | Please feel free to contribute or suggest features and improvements. -------------------------------------------------------------------------------- /public/javascripts/vendor/cm/addon/fold/foldcode.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | "use strict"; 3 | 4 | function doFold(cm, pos, options) { 5 | var finder = options.call ? options : (options && options.rangeFinder); 6 | if (!finder) return; 7 | if (typeof pos == "number") pos = CodeMirror.Pos(pos, 0); 8 | var minSize = options && options.minFoldSize || 0; 9 | 10 | function getRange(allowFolded) { 11 | var range = finder(cm, pos); 12 | if (!range || range.to.line - range.from.line < minSize) return null; 13 | var marks = cm.findMarksAt(range.from); 14 | for (var i = 0; i < marks.length; ++i) { 15 | if (marks[i].__isFold) { 16 | if (!allowFolded) return null; 17 | range.cleared = true; 18 | marks[i].clear(); 19 | } 20 | } 21 | return range; 22 | } 23 | 24 | var range = getRange(true); 25 | if (options && options.scanUp) while (!range && pos.line > cm.firstLine()) { 26 | pos = CodeMirror.Pos(pos.line - 1, 0); 27 | range = getRange(false); 28 | } 29 | if (!range || range.cleared) return; 30 | 31 | var myWidget = makeWidget(options); 32 | CodeMirror.on(myWidget, "mousedown", function() {myRange.clear();}); 33 | var myRange = cm.markText(range.from, range.to, { 34 | replacedWith: myWidget, 35 | clearOnEnter: true, 36 | __isFold: true 37 | }); 38 | } 39 | 40 | function makeWidget(options) { 41 | var widget = (options && options.widget) || "\u2194"; 42 | if (typeof widget == "string") { 43 | var text = document.createTextNode(widget); 44 | widget = document.createElement("span"); 45 | widget.appendChild(text); 46 | widget.className = "CodeMirror-foldmarker"; 47 | } 48 | return widget; 49 | } 50 | 51 | // Clumsy backwards-compatible interface 52 | CodeMirror.newFoldFunction = function(rangeFinder, widget) { 53 | return function(cm, pos) { doFold(cm, pos, {rangeFinder: rangeFinder, widget: widget}); }; 54 | }; 55 | 56 | // New-style interface 57 | CodeMirror.defineExtension("foldCode", function(pos, options) { doFold(this, pos, options); }); 58 | 59 | CodeMirror.combineRangeFinders = function() { 60 | var funcs = Array.prototype.slice.call(arguments, 0); 61 | return function(cm, start) { 62 | for (var i = 0; i < funcs.length; ++i) { 63 | var found = funcs[i](cm, start); 64 | if (found) return found; 65 | } 66 | }; 67 | }; 68 | })(); 69 | -------------------------------------------------------------------------------- /cm/theme/xq-dark.css: -------------------------------------------------------------------------------- 1 | /* 2 | Copyright (C) 2011 by MarkLogic Corporation 3 | Author: Mike Brevoort 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in 13 | all copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 21 | THE SOFTWARE. 22 | */ 23 | .cm-s-xq-dark.CodeMirror { background: #0a001f; color: #f8f8f8; } 24 | .cm-s-xq-dark span.CodeMirror-selected { background: #a8f !important; } 25 | .cm-s-xq-dark .CodeMirror-gutters { background: #0a001f; border-right: 1px solid #aaa; } 26 | .cm-s-xq-dark .CodeMirror-linenumber { color: #f8f8f8; } 27 | .cm-s-xq-dark .CodeMirror-cursor { border-left: 1px solid white !important; } 28 | 29 | .cm-s-xq-dark span.cm-keyword {color: #FFBD40;} 30 | .cm-s-xq-dark span.cm-atom {color: #6C8CD5;} 31 | .cm-s-xq-dark span.cm-number {color: #164;} 32 | .cm-s-xq-dark span.cm-def {color: #FFF; text-decoration:underline;} 33 | .cm-s-xq-dark span.cm-variable {color: #FFF;} 34 | .cm-s-xq-dark span.cm-variable-2 {color: #EEE;} 35 | .cm-s-xq-dark span.cm-variable-3 {color: #DDD;} 36 | .cm-s-xq-dark span.cm-property {} 37 | .cm-s-xq-dark span.cm-operator {} 38 | .cm-s-xq-dark span.cm-comment {color: gray;} 39 | .cm-s-xq-dark span.cm-string {color: #9FEE00;} 40 | .cm-s-xq-dark span.cm-meta {color: yellow;} 41 | .cm-s-xq-dark span.cm-error {color: #f00;} 42 | .cm-s-xq-dark span.cm-qualifier {color: #FFF700;} 43 | .cm-s-xq-dark span.cm-builtin {color: #30a;} 44 | .cm-s-xq-dark span.cm-bracket {color: #cc7;} 45 | .cm-s-xq-dark span.cm-tag {color: #FFBD40;} 46 | .cm-s-xq-dark span.cm-attribute {color: #FFF700;} 47 | -------------------------------------------------------------------------------- /cm/demo/preview.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: HTML5 preview 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 27 | 28 | 29 |

CodeMirror: HTML5 preview

30 | 53 | 54 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /public/javascripts/src/base-extenders.js: -------------------------------------------------------------------------------- 1 | // Extend the prototype of Function w/ bind if it doesn't exist 2 | if (!Function.prototype.bind) { 3 | var slice = function(obj, fromIndex, toIndex) { 4 | return Array.prototype.slice.call(obj, fromIndex, toIndex); 5 | }; 6 | 7 | _.extend(Function.prototype, { 8 | bind: function (oThis) { 9 | if (typeof this !== 'function') { 10 | throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); 11 | } 12 | 13 | var fnArgs = slice(arguments, 1); 14 | var fnToBind = this; 15 | 16 | function fnNoop() {} 17 | function fnBound() { 18 | return fnToBind.apply(this instanceof fnNoop && oThis ? this : oThis, fnArgs); 19 | } 20 | 21 | fnNoop.prototype = this.prototype; 22 | fnBound.prototype = new fnNoop(); 23 | 24 | return fnBound; 25 | } 26 | }); 27 | } 28 | 29 | // Element helpers 30 | _.extend(Element.prototype, { 31 | getComputedStyle: function(style) { 32 | var styles = window.getComputedStyle(this); 33 | return styles[style]; 34 | }, 35 | 36 | hasClosestEl: function(el) { 37 | var currentEl = this; 38 | 39 | while (currentEl.parentElement) { 40 | if (currentEl === el) return true; 41 | currentEl = currentEl.parentElement; 42 | } 43 | 44 | return false; 45 | }, 46 | 47 | getClosest: function(classname) { 48 | var el = this; 49 | 50 | while(el.parentElement) { 51 | if (angular.element(el).hasClass(classname)) 52 | return el; 53 | 54 | el = el.parentElement; 55 | } 56 | 57 | return null; 58 | }, 59 | 60 | getTop: function() { 61 | var top = this.offsetTop; 62 | var parent = this.offsetParent; 63 | 64 | while (parent) { 65 | top += parent.offsetTop; 66 | parent = parent.offsetParent; 67 | } 68 | 69 | return top; 70 | }, 71 | 72 | childElements: function(selector) { 73 | var els = this.querySelectorAll(selector); 74 | var children = _.toArray(this.children); 75 | var childElements = []; 76 | var len = els.length; 77 | var i = 0; 78 | var el; 79 | 80 | while (i < len) { 81 | el = els[i]; 82 | if (children.indexOf(el) !== -1) childElements.push(el); 83 | i++; 84 | } 85 | 86 | return childElements.length ? childElements : null; 87 | } 88 | }); 89 | 90 | _.extend(String.prototype, { 91 | capitalize: function() { 92 | return this.charAt(0).toUpperCase() + this.slice(1); 93 | } 94 | }); -------------------------------------------------------------------------------- /cm/demo/xmlcomplete.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: XML Autocomplete Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 18 | 19 | 20 |

CodeMirror: XML Autocomplete demo

21 | 22 |
23 | 24 |

Type '<' or space inside tag or 25 | press ctrl-space to activate autocompletion. See 26 | the code (here 27 | and here) to figure out how 28 | it works.

29 | 30 | 72 | 73 | 74 | -------------------------------------------------------------------------------- /express/karma.e2e.conf.js: -------------------------------------------------------------------------------- 1 | /* jshint undef: false */ 2 | // // It's used for running client tests on Travis (http://travis-ci.org/#!/vojtajina/testacular) 3 | // Most of the options can be overriden by cli arguments (see testacular --help) 4 | // 5 | // For all available config options and default values, see: 6 | // https://github.com/vojtajina/testacular/blob/stable/lib/config.js#L54 7 | 8 | 9 | // base path, that will be used to resolve files and exclude 10 | basePath = '.'; 11 | jsPath = '../public/javascripts'; 12 | 13 | // list of files / patterns to load in the browser 14 | files = [ 15 | JASMINE 16 | , JASMINE_ADAPTER 17 | , jsPath + '/vendor/jquery.js' 18 | , jsPath + '/vendor/angular.js' 19 | , jsPath + '/vendor/lodash.js' 20 | , ANGULAR_SCENARIO 21 | , ANGULAR_SCENARIO_ADAPTER 22 | , jsPath + '/less2css.js' 23 | , 'test/client/*.spec.js' 24 | ]; 25 | 26 | // list of files to exclude 27 | // exclude = [ 28 | // 'adapter/require.src.js' 29 | // ]; 30 | 31 | // use dots reporter, as travis terminal does not support escaping sequences 32 | // possible values: 'dots', 'progress', 'junit' 33 | // CLI --reporters progress 34 | reporters = ['growl']; 35 | 36 | // junitReporter = { 37 | // // will be resolved to basePath (in the same way as files/exclude patterns) 38 | // outputFile: 'test-results.xml' 39 | // }; 40 | 41 | // web server port 42 | // CLI --port 9876 43 | port = 9876; 44 | 45 | // cli runner port 46 | // CLI --runner-port 9100 47 | runnerPort = 9100; 48 | 49 | // enable / disable colors in the output (reporters and logs) 50 | // CLI --colors --no-colors 51 | colors = true; 52 | 53 | // level of logging 54 | // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG 55 | // CLI --log-level debug 56 | logLevel = LOG_INFO; 57 | 58 | // enable / disable watching file and executing tests whenever any file changes 59 | // CLI --auto-watch --no-auto-watch 60 | autoWatch = false; 61 | 62 | // Start these browsers, currently available: 63 | // - Chrome 64 | // - ChromeCanary 65 | // - Firefox 66 | // - Opera 67 | // - Safari (only Mac) 68 | // - PhantomJS 69 | // - IE (only Windows) 70 | // CLI --browsers Chrome,Firefox,Safari 71 | browsers = ['Chrome']; 72 | 73 | // If browser does not capture in given timeout [ms], kill it 74 | // CLI --capture-timeout 5000 75 | captureTimeout = 5000; 76 | 77 | // Auto run tests on start (when browsers are captured) and exit 78 | // CLI --single-run --no-single-run 79 | singleRun = false; 80 | 81 | // report which specs are slower than 500ms 82 | // CLI --report-slower-than 500 83 | reportSlowerThan = 500; -------------------------------------------------------------------------------- /express/less-options.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | versions: [ 3 | { label: "1.7.5", number: "1.7.5", type: "current" }, 4 | { label: "1.7.4", number: "1.7.4", type: "old" }, 5 | { label: "1.7.3", number: "1.7.3", type: "old" }, 6 | { label: "1.7.2", number: "1.7.2", type: "old" }, 7 | { label: "1.7.1", number: "1.7.1", type: "old" }, 8 | { label: "1.7.0", number: "1.7.0", type: "old" }, 9 | { label: "1.6.3", number: "1.6.3", type: "old" }, 10 | { label: "1.6.2", number: "1.6.2", type: "old" }, 11 | { label: "1.6.1", number: "1.6.1", type: "old" }, 12 | { label: "1.6.0", number: "1.6.0", type: "old" }, 13 | { label: "1.5.1", number: "1.5.1", type: "old" }, 14 | { label: "1.5.0", number: "1.5.0", type: "old" }, 15 | { label: "1.4.2", number: "1.4.2", type: "old" }, 16 | { label: "1.4.1", number: "1.4.1", type: "old" }, 17 | { label: "1.4.0", number: "1.4.0", type: "old" }, 18 | { label: "1.3.3", number: "1.3.3", type: "old" }, 19 | { label: "1.3.2", number: "1.3.2", type: "old" }, 20 | { label: "1.3.1", number: "1.3.1", type: "old" }, 21 | { label: "1.3.0", number: "1.3.0", type: "old" }, 22 | { label: "1.2.2", number: "1.2.2", type: "old" }, 23 | { label: "1.2.1", number: "1.2.1", type: "old" }, 24 | { label: "1.2.0", number: "1.2.0", type: "old" }, 25 | { label: "1.1.6", number: "1.1.6", type: "old" }, 26 | { label: "1.1.5", number: "1.1.5", type: "old" }, 27 | { label: "1.1.4", number: "1.1.4", type: "old" }, 28 | { label: "1.1.3", number: "1.1.3", type: "old" }, 29 | { label: "1.1.2", number: "1.1.2", type: "old" }, 30 | { label: "1.1.1", number: "1.1.1", type: "old" }, 31 | { label: "1.1.0", number: "1.1.0", type: "old" } 32 | ], 33 | 34 | options: { 35 | filename : "less2css.org.less", 36 | rootpath : false, 37 | strictUnits : false, 38 | strictMath : false, 39 | relativeUrls : false, 40 | dumpLineNumbers : false 41 | }, 42 | 43 | lessEditorOptions: { 44 | theme : "lesser-dark", 45 | tabSize : 2, 46 | lineNumbers : true, 47 | matchBrackets : true, 48 | autoCloseBrackets : true 49 | }, 50 | 51 | cssEditorOptions: { 52 | theme : "lesser-dark", 53 | tabSize : 2, 54 | readOnly : true, 55 | lineNumbers : true, 56 | matchBrackets : true 57 | }, 58 | 59 | lineNumberOptions: [ 60 | { label: "Comments", value: "comments", "default": true }, 61 | { label: "Media Query", value: 'mediaquery' }, 62 | { label: "All", value: 'all' } 63 | ] 64 | }; 65 | -------------------------------------------------------------------------------- /express/karma.conf.js: -------------------------------------------------------------------------------- 1 | /* jshint undef: false */ 2 | // // It's used for running client tests on Travis (http://travis-ci.org/#!/vojtajina/testacular) 3 | // Most of the options can be overriden by cli arguments (see testacular --help) 4 | // 5 | // For all available config options and default values, see: 6 | // https://github.com/vojtajina/testacular/blob/stable/lib/config.js#L54 7 | 8 | 9 | // base path, that will be used to resolve files and exclude 10 | try { 11 | basePath = process.cwd().match(/(^[\/\w\d-_]+)(less-preview)/)[0]; 12 | } catch (err) { 13 | throw new Error('Directory structure invalid'); 14 | } 15 | 16 | jsPath = basePath + '/public/javascripts'; 17 | var scripts = require(basePath + '/express/app-scripts.js')(process.cwd()); 18 | 19 | // list of files / patterns to load in the browser 20 | files = [ 21 | JASMINE 22 | , JASMINE_ADAPTER 23 | ]; 24 | 25 | files = files.concat(scripts.testUnit()); 26 | 27 | // list of files to exclude 28 | // exclude = [ 29 | // 'adapter/require.src.js' 30 | // ]; 31 | 32 | // use dots reporter, as travis terminal does not support escaping sequences 33 | // possible values: 'dots', 'progress', 'junit' 34 | // CLI --reporters progress 35 | reporters = ['growl']; 36 | 37 | // junitReporter = { 38 | // // will be resolved to basePath (in the same way as files/exclude patterns) 39 | // outputFile: 'test-results.xml' 40 | // }; 41 | 42 | // web server port 43 | // CLI --port 9876 44 | port = 9876; 45 | 46 | // cli runner port 47 | // CLI --runner-port 9100 48 | runnerPort = 9100; 49 | 50 | // enable / disable colors in the output (reporters and logs) 51 | // CLI --colors --no-colors 52 | colors = true; 53 | 54 | // level of logging 55 | // possible values: LOG_DISABLE || LOG_ERROR || LOG_WARN || LOG_INFO || LOG_DEBUG 56 | // CLI --log-level debug 57 | logLevel = LOG_INFO; 58 | 59 | // enable / disable watching file and executing tests whenever any file changes 60 | // CLI --auto-watch --no-auto-watch 61 | autoWatch = false; 62 | 63 | // Start these browsers, currently available: 64 | // - Chrome 65 | // - ChromeCanary 66 | // - Firefox 67 | // - Opera 68 | // - Safari (only Mac) 69 | // - PhantomJS 70 | // - IE (only Windows) 71 | // CLI --browsers Chrome,Firefox,Safari 72 | browsers = ['Chrome']; 73 | 74 | // If browser does not capture in given timeout [ms], kill it 75 | // CLI --capture-timeout 5000 76 | captureTimeout = 5000; 77 | 78 | // Auto run tests on start (when browsers are captured) and exit 79 | // CLI --single-run --no-single-run 80 | singleRun = false; 81 | 82 | // report which specs are slower than 500ms 83 | // CLI --report-slower-than 500 84 | reportSlowerThan = 500; -------------------------------------------------------------------------------- /cm/demo/complete.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Autocomplete Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |

CodeMirror: Autocomplete demo

16 | 17 |
54 | 55 |

Press ctrl-space to activate autocompletion. See 56 | the code (here 57 | and here) to figure out 58 | how it works.

59 | 60 | 69 | 70 | 71 | -------------------------------------------------------------------------------- /cm/demo/folding.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Code Folding Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 23 | 24 | 25 |

CodeMirror: Code Folding Demo

26 | 27 |

Demonstration of code folding using the code 28 | in foldcode.js. 29 | Press ctrl-q or click on the gutter to fold a block, again 30 | to unfold.
Try the Range Colapse demo as well.

31 |
32 |
JavaScript:
33 |
HTML:
34 |
35 | 66 | 67 | 68 | -------------------------------------------------------------------------------- /public/stylesheets/app/navbar.less: -------------------------------------------------------------------------------- 1 | /* 2 | Stripped-down refactor of bootstrap navs 3 | */ 4 | 5 | @navBg : #bbb; 6 | @navLink : #333; 7 | @navLinkHover : #333; 8 | @navBgHighlight : #efefef; 9 | @navBorderBottomWidth : 1px; 10 | @navHt : 42px; 11 | 12 | .navbar, 13 | .navbar * { .box-sizing(border-box); } 14 | 15 | .navbar { 16 | height: @navHt; 17 | position: fixed; 18 | top: 0; 19 | left: 0; 20 | z-index: 1030; 21 | border-bottom: 1px solid #999; 22 | width: 100%; 23 | 24 | .box-shadow(~"0 1px 10px hsla(0, 0%, 0%, 0.2), inset 0 1px 0 white"); 25 | #gradient > .vertical(@navBgHighlight, @navBg); 26 | 27 | .nav { 28 | white-space: nowrap; 29 | overflow: hidden; 30 | list-style: none; 31 | margin: 0; 32 | 33 | > li { 34 | display: inline-block; 35 | line-height: 1; 36 | padding: 0; 37 | height: @navHt; 38 | vertical-align: top; 39 | 40 | &.divider-vertical { 41 | border-left: 1px solid #a0a0a0; 42 | border-right: 1px solid #eee; 43 | } 44 | 45 | &.brand { 46 | font-size: 20px; 47 | font-weight: 200; 48 | text-shadow: 0 1px 0 @white; 49 | } 50 | 51 | > a, 52 | > span { 53 | padding: 0 20px; 54 | line-height: @navHt; 55 | display: inline-block; 56 | color: hsl(0, 0%, 31%); 57 | text-shadow: 0 1px 1px hsla(0, 0%, 100%, 0.7); 58 | .transition(all 0.2s); 59 | 60 | &:hover { 61 | text-decoration: none; 62 | color: #333; 63 | } 64 | } 65 | 66 | &.active > a, 67 | &.active > a:hover, 68 | &.active > a:focus { 69 | color: @navbarLinkColorActive; 70 | text-decoration: none; 71 | background-color: @navbarLinkBackgroundActive; 72 | .box-shadow(inset 0 3px 8px rgba(0,0,0,.125)); 73 | } 74 | 75 | &.option-info { 76 | span { 77 | cursor: default; 78 | font-size: 12px; 79 | color: hsl(0, 0%, 31%); 80 | padding-left: 10px; 81 | padding-right: 0; 82 | code { 83 | font-size: 10px; 84 | padding: 1px 2px; 85 | background: #e3e3e3; 86 | border: 1px solid #ccc; 87 | text-shadow: none; 88 | } 89 | } 90 | } 91 | } 92 | } 93 | } 94 | 95 | @media (max-width: 979px) { 96 | .navbar-fixed-top .navbar-inner, 97 | .navbar-fixed-bottom .navbar-inner { 98 | padding: 0 5px; 99 | } 100 | 101 | .navbar .nav > li.option-info { display: none; } 102 | } 103 | 104 | @media (max-width: 767px) { 105 | .navbar-fixed-top, 106 | .navbar-fixed-bottom, 107 | .navbar-static-top { 108 | margin: 0; 109 | } 110 | } -------------------------------------------------------------------------------- /cm/demo/formatting.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Formatting Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 23 | 24 | 25 |

CodeMirror: Formatting demo

26 | 27 |
36 | 37 |

Select a piece of code and click one of the links below to apply automatic formatting to the selected text or comment/uncomment the selected text. Note that the formatting behavior depends on the current block's mode. 38 | 39 | 40 | 45 | 50 | 55 | 56 |
41 | 42 | Autoformat Selected 43 | 44 | 46 | 47 | Comment Selected 48 | 49 | 51 | 52 | Uncomment Selected 53 | 54 |
57 |

58 | 79 | 80 | 81 | 82 | -------------------------------------------------------------------------------- /public/javascripts/src/Less2Css/services/LessCompiler.js: -------------------------------------------------------------------------------- 1 | angular 2 | .module('Less2Css') 3 | .factory('LessCompiler', [ 4 | 'Stor', 5 | 'LessLoader', 6 | function(Stor, LessLoader) { 7 | var LessEditorCache = new Stor('LessEditorCache'); 8 | 9 | function LessCompiler() { 10 | this.options = { saveLess : true }; 11 | this.storage = LessEditorCache; 12 | } 13 | 14 | LessCompiler.prototype = { 15 | /** 16 | * Creates the parser 17 | * @return {void} 18 | */ 19 | initLess: function() { 20 | this.parser = new less.Parser(this.lessOptions); 21 | }, 22 | 23 | /** 24 | * Tries to compile the less input 25 | * @param {string} lessCode - Input string of less code 26 | * @return {string} - Either the compiled less or error text 27 | */ 28 | compileLess: function(lessCode) { 29 | if (!this.parser) return ""; 30 | 31 | try { 32 | var compiledCSS = this.parseLess(lessCode, this.lessOptions); 33 | this.error = false; 34 | this.storage.set(lessCode); 35 | return compiledCSS; 36 | } catch (lessEx) { 37 | this.error = true; 38 | if (lessEx.type.toLowerCase() === 'file') this.initLess(); 39 | return this.updateError(lessEx); 40 | } 41 | }, 42 | 43 | /** 44 | * Runs toCSS on the compiled tree (or throws the lessEx error) 45 | * @param {string} lessCode - LESS input string 46 | * @return {string} - CSS Result 47 | */ 48 | parseLess: function(lessCode) { 49 | var lessOptions = this.lessOptions; 50 | var resultCss = ""; 51 | 52 | this.parser.parse(lessCode, function(lessEx, result) { 53 | if (lessEx) throw lessEx; 54 | resultCss = result.toCSS(lessOptions); 55 | }); 56 | 57 | return resultCss; 58 | }, 59 | 60 | /** 61 | * Updates the options and re-initializes less with the new ones 62 | * @param {Object} options - Options object 63 | * @return {void} 64 | */ 65 | updateOptions: function(options) { 66 | this.lessOptions = options; 67 | if (LessLoader.isLoaded()) this.initLess(); 68 | }, 69 | 70 | /** 71 | * Takes the thrown exception and returns formatted error text 72 | * @param {Error} lessEx - LESS Exception object 73 | * @return {string} - String readable version of error text 74 | */ 75 | updateError: function(lessEx) { 76 | var errorText = (lessEx.type + ' error: ' + lessEx.message) + '\n' + (lessEx.extract && lessEx.extract.join && lessEx.extract.join('')); 77 | return errorText; 78 | }, 79 | 80 | getCache: function() { 81 | return this.storage.get(); 82 | } 83 | }; 84 | 85 | return new LessCompiler(); 86 | } 87 | ]); 88 | -------------------------------------------------------------------------------- /cm/demo/widget.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Inline Widget Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 17 | 18 | 19 |

CodeMirror: Inline Widget Demo

20 | 21 |
22 | 69 |

This demo runs JSHint over the code 70 | in the editor (which is the script used on this page), and 71 | inserts line widgets to 72 | display the warnings that JSHint comes up with.

73 | 74 | 75 | -------------------------------------------------------------------------------- /cm/bin/compress: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env node 2 | 3 | // Compression helper for CodeMirror 4 | // 5 | // Example: 6 | // 7 | // bin/compress codemirror runmode javascript xml 8 | // 9 | // Will take lib/codemirror.js, lib/util/runmode.js, 10 | // mode/javascript/javascript.js, and mode/xml/xml.js, run them though 11 | // the online minifier at http://marijnhaverbeke.nl/uglifyjs, and spit 12 | // out the result. 13 | // 14 | // bin/compress codemirror --local /path/to/bin/UglifyJS 15 | // 16 | // Will use a local minifier instead of the online default one. 17 | // 18 | // Script files are specified without .js ending. Prefixing them with 19 | // their full (local) path is optional. So you may say lib/codemirror 20 | // or mode/xml/xml to be more precise. In fact, even the .js suffix 21 | // may be speficied, if wanted. 22 | 23 | "use strict"; 24 | 25 | var fs = require("fs"); 26 | 27 | function help(ok) { 28 | console.log("usage: " + process.argv[1] + " [--local /path/to/uglifyjs] files..."); 29 | process.exit(ok ? 0 : 1); 30 | } 31 | 32 | var local = null, args = null, files = [], blob = ""; 33 | 34 | for (var i = 2; i < process.argv.length; ++i) { 35 | var arg = process.argv[i]; 36 | if (arg == "--local" && i + 1 < process.argv.length) { 37 | var parts = process.argv[++i].split(/\s+/); 38 | local = parts[0]; 39 | args = parts.slice(1); 40 | } else if (arg == "--help") { 41 | help(true); 42 | } else if (arg[0] != "-") { 43 | files.push({name: arg, re: new RegExp("(?:\\/|^)" + arg + (/\.js$/.test(arg) ? "$" : "\\.js$"))}); 44 | } else help(false); 45 | } 46 | 47 | function walk(dir) { 48 | fs.readdirSync(dir).forEach(function(fname) { 49 | if (/^[_\.]/.test(fname)) return; 50 | var file = dir + fname; 51 | if (fs.statSync(file).isDirectory()) return walk(file + "/"); 52 | if (files.some(function(spec, i) { 53 | var match = spec.re.test(file); 54 | if (match) files.splice(i, 1); 55 | return match; 56 | })) { 57 | if (local) args.push(file); 58 | else blob += fs.readFileSync(file, "utf8"); 59 | } 60 | }); 61 | } 62 | 63 | walk("lib/"); 64 | walk("mode/"); 65 | 66 | if (!blob) help(false); 67 | 68 | if (files.length) { 69 | console.log("Some speficied files were not found: " + 70 | files.map(function(a){return a.name;}).join(", ")); 71 | process.exit(1); 72 | } 73 | 74 | if (local) { 75 | require("child_process").spawn(local, args, {stdio: ["ignore", process.stdout, process.stderr]}); 76 | } else { 77 | var data = new Buffer("js_code=" + require("querystring").escape(blob), "utf8"); 78 | var req = require("http").request({ 79 | host: "marijnhaverbeke.nl", 80 | port: 80, 81 | method: "POST", 82 | path: "/uglifyjs", 83 | headers: {"content-type": "application/x-www-form-urlencoded", 84 | "content-length": data.length} 85 | }); 86 | req.on("response", function(resp) { 87 | resp.on("data", function (chunk) { process.stdout.write(chunk); }); 88 | }); 89 | req.end(data); 90 | } 91 | -------------------------------------------------------------------------------- /cm/demo/theme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Theme Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 29 | 30 | 31 |

CodeMirror: Theme demo

32 | 33 |
46 | 47 |

Select a theme: 66 |

67 | 68 | 84 | 85 | 86 | -------------------------------------------------------------------------------- /cm/demo/activeline.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Active Line Demo 6 | 7 | 8 | 9 | 10 | 11 | 15 | 16 | 17 |

CodeMirror: Active Line Demo

18 | 19 |
56 | 57 | 72 | 73 |

Styling the current cursor line.

74 | 75 | 76 | 77 | -------------------------------------------------------------------------------- /views/layout.jade: -------------------------------------------------------------------------------- 1 | doctype html 2 | //if lt IE 7 3 | html.lt-ie9.lt-ie8.lt-ie7(lang='en') 4 | //if IE 7 5 | html.lt-ie9.lt-ie8(lang='en') 6 | //if IE 8 7 | html.lt-ie9(lang='en') 8 | //[if gt IE 8]> pre { 58 | background:none; 59 | border-radius:0; 60 | padding:0; 61 | margin:0; 62 | font-size:2.2em; 63 | line-height:1.2em; 64 | } 65 | 66 | a:link, a:visited, .quasilink { 67 | color: #df0019; 68 | cursor: pointer; 69 | text-decoration: none; 70 | } 71 | 72 | a:hover, .quasilink:hover { 73 | color: #800004; 74 | } 75 | 76 | h1 a:link, h1 a:visited, h1 a:hover { 77 | color: black; 78 | } 79 | 80 | ul { 81 | margin: 0; 82 | padding-left: 1.2em; 83 | } 84 | 85 | a.download { 86 | color: white; 87 | background-color: #df0019; 88 | width: 100%; 89 | display: block; 90 | text-align: center; 91 | font-size: 1.23em; 92 | font-weight: bold; 93 | text-decoration: none; 94 | -moz-border-radius: 6px; 95 | -webkit-border-radius: 6px; 96 | border-radius: 6px; 97 | padding: .5em 0; 98 | margin-bottom: 1em; 99 | } 100 | 101 | a.download:hover { 102 | background-color: #bb0010; 103 | } 104 | 105 | .rel { 106 | margin-bottom: 0; 107 | } 108 | 109 | .rel-note { 110 | color: #777; 111 | font-size: .9em; 112 | margin-top: .1em; 113 | } 114 | 115 | .logo-braces { 116 | color: #df0019; 117 | position: relative; 118 | top: -4px; 119 | } 120 | 121 | .blk { 122 | float: left; 123 | } 124 | 125 | .left { 126 | margin-right: 20.68em; 127 | max-width: 37em; 128 | padding-right: 6.53em; 129 | padding-bottom: 1em; 130 | } 131 | 132 | .left1 { 133 | width: 15.24em; 134 | padding-right: 6.45em; 135 | } 136 | 137 | .left2 { 138 | max-width: 15.24em; 139 | } 140 | 141 | .right { 142 | width: 20.68em; 143 | margin-left: -20.68em; 144 | } 145 | 146 | .leftbig { 147 | width: 42.44em; 148 | padding-right: 6.53em; 149 | } 150 | 151 | .rightsmall { 152 | width: 15.24em; 153 | } 154 | 155 | .clear:after { 156 | visibility: hidden; 157 | display: block; 158 | font-size: 0; 159 | content: " "; 160 | clear: both; 161 | height: 0; 162 | } 163 | .clear { display: inline-block; } 164 | /* start commented backslash hack \*/ 165 | * html .clear { height: 1%; } 166 | .clear { display: block; } 167 | /* close commented backslash hack */ 168 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/pagination.less: -------------------------------------------------------------------------------- 1 | // 2 | // Pagination (multiple pages) 3 | // -------------------------------------------------- 4 | 5 | // Space out pagination from surrounding content 6 | .pagination { 7 | margin: @baseLineHeight 0; 8 | } 9 | 10 | .pagination ul { 11 | // Allow for text-based alignment 12 | display: inline-block; 13 | .ie7-inline-block(); 14 | // Reset default ul styles 15 | margin-left: 0; 16 | margin-bottom: 0; 17 | // Visuals 18 | .border-radius(@baseBorderRadius); 19 | .box-shadow(0 1px 2px rgba(0,0,0,.05)); 20 | } 21 | .pagination ul > li { 22 | display: inline; // Remove list-style and block-level defaults 23 | } 24 | .pagination ul > li > a, 25 | .pagination ul > li > span { 26 | float: left; // Collapse white-space 27 | padding: 4px 12px; 28 | line-height: @baseLineHeight; 29 | text-decoration: none; 30 | background-color: @paginationBackground; 31 | border: 1px solid @paginationBorder; 32 | border-left-width: 0; 33 | } 34 | .pagination ul > li > a:hover, 35 | .pagination ul > li > a:focus, 36 | .pagination ul > .active > a, 37 | .pagination ul > .active > span { 38 | background-color: @paginationActiveBackground; 39 | } 40 | .pagination ul > .active > a, 41 | .pagination ul > .active > span { 42 | color: @grayLight; 43 | cursor: default; 44 | } 45 | .pagination ul > .disabled > span, 46 | .pagination ul > .disabled > a, 47 | .pagination ul > .disabled > a:hover, 48 | .pagination ul > .disabled > a:focus { 49 | color: @grayLight; 50 | background-color: transparent; 51 | cursor: default; 52 | } 53 | .pagination ul > li:first-child > a, 54 | .pagination ul > li:first-child > span { 55 | border-left-width: 1px; 56 | .border-left-radius(@baseBorderRadius); 57 | } 58 | .pagination ul > li:last-child > a, 59 | .pagination ul > li:last-child > span { 60 | .border-right-radius(@baseBorderRadius); 61 | } 62 | 63 | 64 | // Alignment 65 | // -------------------------------------------------- 66 | 67 | .pagination-centered { 68 | text-align: center; 69 | } 70 | .pagination-right { 71 | text-align: right; 72 | } 73 | 74 | 75 | // Sizing 76 | // -------------------------------------------------- 77 | 78 | // Large 79 | .pagination-large { 80 | ul > li > a, 81 | ul > li > span { 82 | padding: @paddingLarge; 83 | font-size: @fontSizeLarge; 84 | } 85 | ul > li:first-child > a, 86 | ul > li:first-child > span { 87 | .border-left-radius(@borderRadiusLarge); 88 | } 89 | ul > li:last-child > a, 90 | ul > li:last-child > span { 91 | .border-right-radius(@borderRadiusLarge); 92 | } 93 | } 94 | 95 | // Small and mini 96 | .pagination-mini, 97 | .pagination-small { 98 | ul > li:first-child > a, 99 | ul > li:first-child > span { 100 | .border-left-radius(@borderRadiusSmall); 101 | } 102 | ul > li:last-child > a, 103 | ul > li:last-child > span { 104 | .border-right-radius(@borderRadiusSmall); 105 | } 106 | } 107 | 108 | // Small 109 | .pagination-small { 110 | ul > li > a, 111 | ul > li > span { 112 | padding: @paddingSmall; 113 | font-size: @fontSizeSmall; 114 | } 115 | } 116 | // Mini 117 | .pagination-mini { 118 | ul > li > a, 119 | ul > li > span { 120 | padding: @paddingMini; 121 | font-size: @fontSizeMini; 122 | } 123 | } 124 | -------------------------------------------------------------------------------- /Gruntfile.js: -------------------------------------------------------------------------------- 1 | var scripts = require('./express/app-scripts')(process.cwd()); 2 | var src = scripts.development(); 3 | 4 | module.exports = function(grunt) { 5 | var js_globals = Object.keys(grunt.file.readJSON('./.jshintrc').globals); 6 | var uglify_options = { 7 | compress: { 8 | loops : true, 9 | unused : true, 10 | unsafe : true, 11 | cascade : true, 12 | warnings : true, 13 | booleans : true, 14 | evaluate : true, 15 | dead_code : true, 16 | join_vars : true, 17 | if_return : true, 18 | sequences : true, 19 | hoist_vars : false, 20 | hoist_funs : true, 21 | properties : true, 22 | comparisons : true, 23 | conditionals : true 24 | }, 25 | mangle: { except: js_globals } 26 | }; 27 | 28 | grunt.loadNpmTasks('grunt-contrib-uglify'); 29 | grunt.loadNpmTasks('grunt-contrib-concat'); 30 | grunt.loadNpmTasks('grunt-contrib-watch'); 31 | grunt.loadNpmTasks('grunt-contrib-jshint'); 32 | 33 | grunt.initConfig({ 34 | pkg: grunt.file.readJSON('package.json'), 35 | meta: { 36 | banner: [ 37 | '/* <%= pkg.name %> - v<%= pkg.version %> - <%= pkg.homepage %>', 38 | ' * Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author %>. All rights reserved.', 39 | ' * Licensed <%= _.pluck(pkg.licenses, "type")[0] %> - <%= _.pluck(pkg.licenses, "url")[0] %>', 40 | ' */', 41 | '' 42 | ].join('\n') 43 | }, 44 | 45 | paths: { 46 | js : './public/javascripts', 47 | tmp : './tmp', 48 | test : './test', 49 | routes : './routes', 50 | express : './express' 51 | }, 52 | 53 | concat: { 54 | app: { 55 | src: src.app, 56 | dest: '<%= paths.tmp %>/less2css.js' 57 | }, 58 | 59 | vendor: { 60 | src: src.vendor, 61 | dest: '<%= paths.tmp %>/vendor.js' 62 | }, 63 | 64 | build: { 65 | options: { banner: '<%= meta.banner %>'}, 66 | files: { 67 | '<%= paths.js %>/less2css.min.js': ['<%= paths.js %>/less2css.min.js'] 68 | } 69 | } 70 | }, 71 | 72 | watch: { 73 | js: { 74 | files: [ 75 | '<%= paths.js %>/options-drawer.js', 76 | '<%= paths.js %>/src/**/*.js' 77 | ], 78 | tasks: ['concat:app', 'jshint'] 79 | }, 80 | tests: { 81 | files: ['<%= paths.test %>/**/*.spec.js'], 82 | tasks: ['karma:unit:run'] 83 | } 84 | }, 85 | 86 | uglify: { 87 | app: { 88 | options: uglify_options, 89 | files: { 90 | '<%= paths.js %>/less2css.min.js': ['<%= paths.tmp %>/less2css.js'] 91 | } 92 | }, 93 | vendor: { 94 | options: uglify_options, 95 | files: { 96 | '<%= paths.js %>/vendor.min.js': ['<%= paths.tmp %>/vendor.js'] 97 | } 98 | } 99 | }, 100 | jshint: { 101 | options: { jshintrc: './.jshintrc' }, 102 | all: ['<%= paths.tmp %>/less2css.js'] 103 | } 104 | }); 105 | 106 | grunt.registerTask('default', [ 107 | 'concat:app', 108 | 'concat:vendor', 109 | 'jshint', 110 | 'uglify', 111 | 'concat:build' 112 | ]); 113 | }; -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/carousel.less: -------------------------------------------------------------------------------- 1 | // 2 | // Carousel 3 | // -------------------------------------------------- 4 | 5 | 6 | .carousel { 7 | position: relative; 8 | margin-bottom: @baseLineHeight; 9 | line-height: 1; 10 | } 11 | 12 | .carousel-inner { 13 | overflow: hidden; 14 | width: 100%; 15 | position: relative; 16 | } 17 | 18 | .carousel-inner { 19 | 20 | > .item { 21 | display: none; 22 | position: relative; 23 | .transition(.6s ease-in-out left); 24 | 25 | // Account for jankitude on images 26 | > img, 27 | > a > img { 28 | display: block; 29 | line-height: 1; 30 | } 31 | } 32 | 33 | > .active, 34 | > .next, 35 | > .prev { display: block; } 36 | 37 | > .active { 38 | left: 0; 39 | } 40 | 41 | > .next, 42 | > .prev { 43 | position: absolute; 44 | top: 0; 45 | width: 100%; 46 | } 47 | 48 | > .next { 49 | left: 100%; 50 | } 51 | > .prev { 52 | left: -100%; 53 | } 54 | > .next.left, 55 | > .prev.right { 56 | left: 0; 57 | } 58 | 59 | > .active.left { 60 | left: -100%; 61 | } 62 | > .active.right { 63 | left: 100%; 64 | } 65 | 66 | } 67 | 68 | // Left/right controls for nav 69 | // --------------------------- 70 | 71 | .carousel-control { 72 | position: absolute; 73 | top: 40%; 74 | left: 15px; 75 | width: 40px; 76 | height: 40px; 77 | margin-top: -20px; 78 | font-size: 60px; 79 | font-weight: 100; 80 | line-height: 30px; 81 | color: @white; 82 | text-align: center; 83 | background: @grayDarker; 84 | border: 3px solid @white; 85 | .border-radius(23px); 86 | .opacity(50); 87 | 88 | // we can't have this transition here 89 | // because webkit cancels the carousel 90 | // animation if you trip this while 91 | // in the middle of another animation 92 | // ;_; 93 | // .transition(opacity .2s linear); 94 | 95 | // Reposition the right one 96 | &.right { 97 | left: auto; 98 | right: 15px; 99 | } 100 | 101 | // Hover/focus state 102 | &:hover, 103 | &:focus { 104 | color: @white; 105 | text-decoration: none; 106 | .opacity(90); 107 | } 108 | } 109 | 110 | // Carousel indicator pips 111 | // ----------------------------- 112 | .carousel-indicators { 113 | position: absolute; 114 | top: 15px; 115 | right: 15px; 116 | z-index: 5; 117 | margin: 0; 118 | list-style: none; 119 | 120 | li { 121 | display: block; 122 | float: left; 123 | width: 10px; 124 | height: 10px; 125 | margin-left: 5px; 126 | text-indent: -999px; 127 | background-color: #ccc; 128 | background-color: rgba(255,255,255,.25); 129 | border-radius: 5px; 130 | } 131 | .active { 132 | background-color: #fff; 133 | } 134 | } 135 | 136 | // Caption for text below images 137 | // ----------------------------- 138 | 139 | .carousel-caption { 140 | position: absolute; 141 | left: 0; 142 | right: 0; 143 | bottom: 0; 144 | padding: 15px; 145 | background: @grayDark; 146 | background: rgba(0,0,0,.75); 147 | } 148 | .carousel-caption h4, 149 | .carousel-caption p { 150 | color: @white; 151 | line-height: @baseLineHeight; 152 | } 153 | .carousel-caption h4 { 154 | margin: 0 0 5px; 155 | } 156 | .carousel-caption p { 157 | margin-bottom: 0; 158 | } 159 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/progress-bars.less: -------------------------------------------------------------------------------- 1 | // 2 | // Progress bars 3 | // -------------------------------------------------- 4 | 5 | 6 | // ANIMATIONS 7 | // ---------- 8 | 9 | // Webkit 10 | @-webkit-keyframes progress-bar-stripes { 11 | from { background-position: 40px 0; } 12 | to { background-position: 0 0; } 13 | } 14 | 15 | // Firefox 16 | @-moz-keyframes progress-bar-stripes { 17 | from { background-position: 40px 0; } 18 | to { background-position: 0 0; } 19 | } 20 | 21 | // IE9 22 | @-ms-keyframes progress-bar-stripes { 23 | from { background-position: 40px 0; } 24 | to { background-position: 0 0; } 25 | } 26 | 27 | // Opera 28 | @-o-keyframes progress-bar-stripes { 29 | from { background-position: 0 0; } 30 | to { background-position: 40px 0; } 31 | } 32 | 33 | // Spec 34 | @keyframes progress-bar-stripes { 35 | from { background-position: 40px 0; } 36 | to { background-position: 0 0; } 37 | } 38 | 39 | 40 | 41 | // THE BARS 42 | // -------- 43 | 44 | // Outer container 45 | .progress { 46 | overflow: hidden; 47 | height: @baseLineHeight; 48 | margin-bottom: @baseLineHeight; 49 | #gradient > .vertical(#f5f5f5, #f9f9f9); 50 | .box-shadow(inset 0 1px 2px rgba(0,0,0,.1)); 51 | .border-radius(@baseBorderRadius); 52 | } 53 | 54 | // Bar of progress 55 | .progress .bar { 56 | width: 0%; 57 | height: 100%; 58 | color: @white; 59 | float: left; 60 | font-size: 12px; 61 | text-align: center; 62 | text-shadow: 0 -1px 0 rgba(0,0,0,.25); 63 | #gradient > .vertical(#149bdf, #0480be); 64 | .box-shadow(inset 0 -1px 0 rgba(0,0,0,.15)); 65 | .box-sizing(border-box); 66 | .transition(width .6s ease); 67 | } 68 | .progress .bar + .bar { 69 | .box-shadow(~"inset 1px 0 0 rgba(0,0,0,.15), inset 0 -1px 0 rgba(0,0,0,.15)"); 70 | } 71 | 72 | // Striped bars 73 | .progress-striped .bar { 74 | #gradient > .striped(#149bdf); 75 | .background-size(40px 40px); 76 | } 77 | 78 | // Call animation for the active one 79 | .progress.active .bar { 80 | -webkit-animation: progress-bar-stripes 2s linear infinite; 81 | -moz-animation: progress-bar-stripes 2s linear infinite; 82 | -ms-animation: progress-bar-stripes 2s linear infinite; 83 | -o-animation: progress-bar-stripes 2s linear infinite; 84 | animation: progress-bar-stripes 2s linear infinite; 85 | } 86 | 87 | 88 | 89 | // COLORS 90 | // ------ 91 | 92 | // Danger (red) 93 | .progress-danger .bar, .progress .bar-danger { 94 | #gradient > .vertical(#ee5f5b, #c43c35); 95 | } 96 | .progress-danger.progress-striped .bar, .progress-striped .bar-danger { 97 | #gradient > .striped(#ee5f5b); 98 | } 99 | 100 | // Success (green) 101 | .progress-success .bar, .progress .bar-success { 102 | #gradient > .vertical(#62c462, #57a957); 103 | } 104 | .progress-success.progress-striped .bar, .progress-striped .bar-success { 105 | #gradient > .striped(#62c462); 106 | } 107 | 108 | // Info (teal) 109 | .progress-info .bar, .progress .bar-info { 110 | #gradient > .vertical(#5bc0de, #339bb9); 111 | } 112 | .progress-info.progress-striped .bar, .progress-striped .bar-info { 113 | #gradient > .striped(#5bc0de); 114 | } 115 | 116 | // Warning (orange) 117 | .progress-warning .bar, .progress .bar-warning { 118 | #gradient > .vertical(lighten(@orange, 15%), @orange); 119 | } 120 | .progress-warning.progress-striped .bar, .progress-striped .bar-warning { 121 | #gradient > .striped(lighten(@orange, 15%)); 122 | } 123 | -------------------------------------------------------------------------------- /cm/test/lint/lint.js: -------------------------------------------------------------------------------- 1 | /* 2 | Simple linter, based on the Acorn [1] parser module 3 | 4 | All of the existing linters either cramp my style or have huge 5 | dependencies (Closure). So here's a very simple, non-invasive one 6 | that only spots 7 | 8 | - missing semicolons and trailing commas 9 | - variables or properties that are reserved words 10 | - assigning to a variable you didn't declare 11 | 12 | [1]: https://github.com/marijnh/acorn/ 13 | */ 14 | 15 | var fs = require("fs"), acorn = require("./acorn.js"), walk = require("./walk.js"); 16 | 17 | var scopePasser = walk.make({ 18 | ScopeBody: function(node, prev, c) { c(node, node.scope); } 19 | }); 20 | 21 | function checkFile(fileName) { 22 | var file = fs.readFileSync(fileName, "utf8"); 23 | var badChar = file.match(/[\x00-\x08\x0b\x0c\x0e-\x19\uFEFF]/); 24 | if (badChar) 25 | fail("Undesirable character " + badChar[0].charCodeAt(0) + " at position " + badChar.index, 26 | {source: fileName}); 27 | 28 | try { 29 | var parsed = acorn.parse(file, { 30 | locations: true, 31 | ecmaVersion: 3, 32 | strictSemicolons: true, 33 | forbidReserved: true, 34 | sourceFile: fileName 35 | }); 36 | } catch (e) { 37 | fail(e.message, {source: fileName}); 38 | return; 39 | } 40 | 41 | var scopes = []; 42 | 43 | walk.simple(parsed, { 44 | ScopeBody: function(node, scope) { 45 | node.scope = scope; 46 | scopes.push(scope); 47 | } 48 | }, walk.scopeVisitor, {vars: Object.create(null)}); 49 | 50 | var ignoredGlobals = Object.create(null); 51 | 52 | function inScope(name, scope) { 53 | for (var cur = scope; cur; cur = cur.prev) 54 | if (name in cur.vars) return true; 55 | } 56 | function checkLHS(node, scope) { 57 | if (node.type == "Identifier" && !(node.name in ignoredGlobals) && 58 | !inScope(node.name, scope)) { 59 | ignoredGlobals[node.name] = true; 60 | fail("Assignment to global variable", node.loc); 61 | } 62 | } 63 | 64 | walk.simple(parsed, { 65 | UpdateExpression: function(node, scope) {checkLHS(node.argument, scope);}, 66 | AssignmentExpression: function(node, scope) {checkLHS(node.left, scope);}, 67 | Identifier: function(node, scope) { 68 | // Mark used identifiers 69 | for (var cur = scope; cur; cur = cur.prev) 70 | if (node.name in cur.vars) { 71 | cur.vars[node.name].used = true; 72 | return; 73 | } 74 | } 75 | }, scopePasser); 76 | 77 | for (var i = 0; i < scopes.length; ++i) { 78 | var scope = scopes[i]; 79 | for (var name in scope.vars) { 80 | var info = scope.vars[name]; 81 | if (!info.used && info.type != "catch clause" && info.type != "function name" && name.charAt(0) != "_") 82 | fail("Unused " + info.type + " " + name, info.node.loc); 83 | } 84 | } 85 | } 86 | 87 | var failed = false; 88 | function fail(msg, pos) { 89 | if (pos.start) msg += " (" + pos.start.line + ":" + pos.start.column + ")"; 90 | console.log(pos.source.match(/[^\/]+$/)[0] + ": " + msg); 91 | failed = true; 92 | } 93 | 94 | function checkDir(dir) { 95 | fs.readdirSync(dir).forEach(function(file) { 96 | var fname = dir + "/" + file; 97 | if (/\.js$/.test(file)) checkFile(fname); 98 | else if (fs.lstatSync(fname).isDirectory()) checkDir(fname); 99 | }); 100 | } 101 | 102 | exports.checkDir = checkDir; 103 | exports.checkFile = checkFile; 104 | exports.success = function() { return !failed; }; 105 | -------------------------------------------------------------------------------- /public/javascripts/vendor/cm/addon/edit/closebrackets.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var DEFAULT_BRACKETS = "()[]{}''\"\""; 3 | var DEFAULT_EXPLODE_ON_ENTER = "[]{}"; 4 | var SPACE_CHAR_REGEX = /\s/; 5 | 6 | CodeMirror.defineOption("autoCloseBrackets", false, function(cm, val, old) { 7 | if (old != CodeMirror.Init && old) 8 | cm.removeKeyMap("autoCloseBrackets"); 9 | if (!val) return; 10 | var pairs = DEFAULT_BRACKETS, explode = DEFAULT_EXPLODE_ON_ENTER; 11 | if (typeof val == "string") pairs = val; 12 | else if (typeof val == "object") { 13 | if (val.pairs != null) pairs = val.pairs; 14 | if (val.explode != null) explode = val.explode; 15 | } 16 | var map = buildKeymap(pairs); 17 | if (explode) map.Enter = buildExplodeHandler(explode); 18 | cm.addKeyMap(map); 19 | }); 20 | 21 | function charsAround(cm, pos) { 22 | var str = cm.getRange(CodeMirror.Pos(pos.line, pos.ch - 1), 23 | CodeMirror.Pos(pos.line, pos.ch + 1)); 24 | return str.length == 2 ? str : null; 25 | } 26 | 27 | function buildKeymap(pairs) { 28 | var map = { 29 | name : "autoCloseBrackets", 30 | Backspace: function(cm) { 31 | if (cm.somethingSelected()) return CodeMirror.Pass; 32 | var cur = cm.getCursor(), around = charsAround(cm, cur); 33 | if (around && pairs.indexOf(around) % 2 == 0) 34 | cm.replaceRange("", CodeMirror.Pos(cur.line, cur.ch - 1), CodeMirror.Pos(cur.line, cur.ch + 1)); 35 | else 36 | return CodeMirror.Pass; 37 | } 38 | }; 39 | var closingBrackets = ""; 40 | for (var i = 0; i < pairs.length; i += 2) (function(left, right) { 41 | if (left != right) closingBrackets += right; 42 | function surround(cm) { 43 | var selection = cm.getSelection(); 44 | cm.replaceSelection(left + selection + right); 45 | } 46 | function maybeOverwrite(cm) { 47 | var cur = cm.getCursor(), ahead = cm.getRange(cur, CodeMirror.Pos(cur.line, cur.ch + 1)); 48 | if (ahead != right || cm.somethingSelected()) return CodeMirror.Pass; 49 | else cm.execCommand("goCharRight"); 50 | } 51 | map["'" + left + "'"] = function(cm) { 52 | if (left == "'" && cm.getTokenAt(cm.getCursor()).type == "comment") 53 | return CodeMirror.Pass; 54 | if (cm.somethingSelected()) return surround(cm); 55 | if (left == right && maybeOverwrite(cm) != CodeMirror.Pass) return; 56 | var cur = cm.getCursor(), ahead = CodeMirror.Pos(cur.line, cur.ch + 1); 57 | var line = cm.getLine(cur.line), nextChar = line.charAt(cur.ch); 58 | if (line.length == cur.ch || closingBrackets.indexOf(nextChar) >= 0 || SPACE_CHAR_REGEX.test(nextChar)) 59 | cm.replaceSelection(left + right, {head: ahead, anchor: ahead}); 60 | else 61 | return CodeMirror.Pass; 62 | }; 63 | if (left != right) map["'" + right + "'"] = maybeOverwrite; 64 | })(pairs.charAt(i), pairs.charAt(i + 1)); 65 | return map; 66 | } 67 | 68 | function buildExplodeHandler(pairs) { 69 | return function(cm) { 70 | var cur = cm.getCursor(), around = charsAround(cm, cur); 71 | if (!around || pairs.indexOf(around) % 2 != 0) return CodeMirror.Pass; 72 | cm.operation(function() { 73 | var newPos = CodeMirror.Pos(cur.line + 1, 0); 74 | cm.replaceSelection("\n\n", {anchor: newPos, head: newPos}, "+input"); 75 | cm.indentLine(cur.line + 1, null, true); 76 | cm.indentLine(cur.line + 2, null, true); 77 | }); 78 | }; 79 | } 80 | })(); 81 | -------------------------------------------------------------------------------- /cm/demo/btree.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: B-Tree visualization 6 | 7 | 8 | 9 | 10 | 14 | 15 | 16 |

CodeMirror: B-Tree visualization

17 | 18 |

Shows a visual representation of the b-tree that CodeMirror 19 | uses to store its document. See 20 | the corresponding 21 | blog post for a description of this format. The gray blocks 22 | under each leaf show the lines it holds (with their width 23 | representing the line height). Add and remove content to see how 24 | the nodes are split and merged to keep the tree balanced.

25 | 26 |
27 |
28 |
29 |
30 |
31 |
32 | 33 | 83 | 84 |

85 | 86 | 87 | 88 | -------------------------------------------------------------------------------- /public/javascripts/vendor/cm/addon/fold/brace-fold.js: -------------------------------------------------------------------------------- 1 | CodeMirror.braceRangeFinder = function(cm, start) { 2 | var line = start.line, lineText = cm.getLine(line); 3 | var startCh, tokenType; 4 | 5 | function findOpening(openCh) { 6 | for (var at = start.ch, pass = 0;;) { 7 | var found = lineText.lastIndexOf(openCh, at - 1); 8 | if (found == -1) { 9 | if (pass == 1) break; 10 | pass = 1; 11 | at = lineText.length; 12 | continue; 13 | } 14 | if (pass == 1 && found < start.ch) break; 15 | tokenType = cm.getTokenAt(CodeMirror.Pos(line, found + 1)).type; 16 | if (!/^(comment|string)/.test(tokenType)) return found + 1; 17 | at = found - 1; 18 | } 19 | } 20 | 21 | var startToken = "{", endToken = "}", startCh = findOpening("{"); 22 | if (startCh == null) { 23 | startToken = "[", endToken = "]"; 24 | startCh = findOpening("["); 25 | } 26 | 27 | if (startCh == null) return; 28 | var count = 1, lastLine = cm.lastLine(), end, endCh; 29 | outer: for (var i = line; i <= lastLine; ++i) { 30 | var text = cm.getLine(i), pos = i == line ? startCh : 0; 31 | for (;;) { 32 | var nextOpen = text.indexOf(startToken, pos), nextClose = text.indexOf(endToken, pos); 33 | if (nextOpen < 0) nextOpen = text.length; 34 | if (nextClose < 0) nextClose = text.length; 35 | pos = Math.min(nextOpen, nextClose); 36 | if (pos == text.length) break; 37 | if (cm.getTokenAt(CodeMirror.Pos(i, pos + 1)).type == tokenType) { 38 | if (pos == nextOpen) ++count; 39 | else if (!--count) { end = i; endCh = pos; break outer; } 40 | } 41 | ++pos; 42 | } 43 | } 44 | if (end == null || line == end && endCh == startCh) return; 45 | return {from: CodeMirror.Pos(line, startCh), 46 | to: CodeMirror.Pos(end, endCh)}; 47 | }; 48 | 49 | CodeMirror.importRangeFinder = function(cm, start) { 50 | function hasImport(line) { 51 | if (line < cm.firstLine() || line > cm.lastLine()) return null; 52 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); 53 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); 54 | if (start.type != "keyword" || start.string != "import") return null; 55 | // Now find closing semicolon, return its position 56 | for (var i = line, e = Math.min(cm.lastLine(), line + 10); i <= e; ++i) { 57 | var text = cm.getLine(i), semi = text.indexOf(";"); 58 | if (semi != -1) return {startCh: start.end, end: CodeMirror.Pos(i, semi)}; 59 | } 60 | } 61 | 62 | var start = start.line, has = hasImport(start), prev; 63 | if (!has || hasImport(start - 1) || ((prev = hasImport(start - 2)) && prev.end.line == start - 1)) 64 | return null; 65 | for (var end = has.end;;) { 66 | var next = hasImport(end.line + 1); 67 | if (next == null) break; 68 | end = next.end; 69 | } 70 | return {from: cm.clipPos(CodeMirror.Pos(start, has.startCh + 1)), to: end}; 71 | }; 72 | 73 | CodeMirror.includeRangeFinder = function(cm, start) { 74 | function hasInclude(line) { 75 | if (line < cm.firstLine() || line > cm.lastLine()) return null; 76 | var start = cm.getTokenAt(CodeMirror.Pos(line, 1)); 77 | if (!/\S/.test(start.string)) start = cm.getTokenAt(CodeMirror.Pos(line, start.end + 1)); 78 | if (start.type == "meta" && start.string.slice(0, 8) == "#include") return start.start + 8; 79 | } 80 | 81 | var start = start.line, has = hasInclude(start); 82 | if (has == null || hasInclude(start - 1) != null) return null; 83 | for (var end = start;;) { 84 | var next = hasInclude(end + 1); 85 | if (next == null) break; 86 | ++end; 87 | } 88 | return {from: CodeMirror.Pos(start, has + 1), 89 | to: cm.clipPos(CodeMirror.Pos(end))}; 90 | }; 91 | -------------------------------------------------------------------------------- /public/stylesheets/bootstrap/popovers.less: -------------------------------------------------------------------------------- 1 | // 2 | // Popovers 3 | // -------------------------------------------------- 4 | 5 | 6 | .popover { 7 | position: absolute; 8 | top: 0; 9 | left: 0; 10 | z-index: @zindexPopover; 11 | display: none; 12 | max-width: 276px; 13 | padding: 1px; 14 | text-align: left; // Reset given new insertion method 15 | background-color: @popoverBackground; 16 | -webkit-background-clip: padding-box; 17 | -moz-background-clip: padding; 18 | background-clip: padding-box; 19 | border: 1px solid #ccc; 20 | border: 1px solid rgba(0,0,0,.2); 21 | .border-radius(6px); 22 | .box-shadow(0 5px 10px rgba(0,0,0,.2)); 23 | 24 | // Overrides for proper insertion 25 | white-space: normal; 26 | 27 | // Offset the popover to account for the popover arrow 28 | &.top { margin-top: -10px; } 29 | &.right { margin-left: 10px; } 30 | &.bottom { margin-top: 10px; } 31 | &.left { margin-left: -10px; } 32 | } 33 | 34 | .popover-title { 35 | margin: 0; // reset heading margin 36 | padding: 8px 14px; 37 | font-size: 14px; 38 | font-weight: normal; 39 | line-height: 18px; 40 | background-color: @popoverTitleBackground; 41 | border-bottom: 1px solid darken(@popoverTitleBackground, 5%); 42 | .border-radius(5px 5px 0 0); 43 | 44 | &:empty { 45 | display: none; 46 | } 47 | } 48 | 49 | .popover-content { 50 | padding: 9px 14px; 51 | } 52 | 53 | // Arrows 54 | // 55 | // .arrow is outer, .arrow:after is inner 56 | 57 | .popover .arrow, 58 | .popover .arrow:after { 59 | position: absolute; 60 | display: block; 61 | width: 0; 62 | height: 0; 63 | border-color: transparent; 64 | border-style: solid; 65 | } 66 | .popover .arrow { 67 | border-width: @popoverArrowOuterWidth; 68 | } 69 | .popover .arrow:after { 70 | border-width: @popoverArrowWidth; 71 | content: ""; 72 | } 73 | 74 | .popover { 75 | &.top .arrow { 76 | left: 50%; 77 | margin-left: -@popoverArrowOuterWidth; 78 | border-bottom-width: 0; 79 | border-top-color: #999; // IE8 fallback 80 | border-top-color: @popoverArrowOuterColor; 81 | bottom: -@popoverArrowOuterWidth; 82 | &:after { 83 | bottom: 1px; 84 | margin-left: -@popoverArrowWidth; 85 | border-bottom-width: 0; 86 | border-top-color: @popoverArrowColor; 87 | } 88 | } 89 | &.right .arrow { 90 | top: 50%; 91 | left: -@popoverArrowOuterWidth; 92 | margin-top: -@popoverArrowOuterWidth; 93 | border-left-width: 0; 94 | border-right-color: #999; // IE8 fallback 95 | border-right-color: @popoverArrowOuterColor; 96 | &:after { 97 | left: 1px; 98 | bottom: -@popoverArrowWidth; 99 | border-left-width: 0; 100 | border-right-color: @popoverArrowColor; 101 | } 102 | } 103 | &.bottom .arrow { 104 | left: 50%; 105 | margin-left: -@popoverArrowOuterWidth; 106 | border-top-width: 0; 107 | border-bottom-color: #999; // IE8 fallback 108 | border-bottom-color: @popoverArrowOuterColor; 109 | top: -@popoverArrowOuterWidth; 110 | &:after { 111 | top: 1px; 112 | margin-left: -@popoverArrowWidth; 113 | border-top-width: 0; 114 | border-bottom-color: @popoverArrowColor; 115 | } 116 | } 117 | 118 | &.left .arrow { 119 | top: 50%; 120 | right: -@popoverArrowOuterWidth; 121 | margin-top: -@popoverArrowOuterWidth; 122 | border-right-width: 0; 123 | border-left-color: #999; // IE8 fallback 124 | border-left-color: @popoverArrowOuterColor; 125 | &:after { 126 | right: 1px; 127 | border-right-width: 0; 128 | border-left-color: @popoverArrowColor; 129 | bottom: -@popoverArrowWidth; 130 | } 131 | } 132 | 133 | } 134 | -------------------------------------------------------------------------------- /cm/demo/search.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Search/Replace Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 19 | 20 | 21 |

CodeMirror: Search/Replace Demo

22 | 23 |
64 | 65 | 68 | 69 |

Demonstration of primitive search/replace functionality. The 70 | keybindings (which can be overridden by custom keymaps) are:

71 |
72 |
Ctrl-F / Cmd-F
Start searching
73 |
Ctrl-G / Cmd-G
Find next
74 |
Shift-Ctrl-G / Shift-Cmd-G
Find previous
75 |
Shift-Ctrl-F / Cmd-Option-F
Replace
76 |
Shift-Ctrl-R / Shift-Cmd-Option-F
Replace all
77 |
78 |

Searching is enabled by 79 | including lib/util/search.js 80 | and lib/util/searchcursor.js. 81 | For good-looking input dialogs, you also want to include 82 | lib/util/dialog.js 83 | and lib/util/dialog.css.

84 | 85 | 86 | -------------------------------------------------------------------------------- /public/stylesheets/app/gh.less: -------------------------------------------------------------------------------- 1 | .github-fork-ribbon { 2 | // The right and left lasses determine the side we attach our banner to 3 | position: absolute; 4 | 5 | // Add a bit of padding to give some substance outside the "stitching" 6 | padding: 2px 0; 7 | 8 | // Set the base colour 9 | background-color: #505050; 10 | 11 | background-image: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0.00)), to(rgba(0, 0, 0, 0.15))); 12 | background-image: -webkit-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 13 | background-image: -moz-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 14 | background-image: -o-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 15 | background-image: -ms-linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 16 | background-image: linear-gradient(top, rgba(0, 0, 0, 0.00), rgba(0, 0, 0, 0.15)); 17 | 18 | .box-shadow(0 2px 3px 0 rgba(0,0,0,0.5)); 19 | } 20 | 21 | .github-fork-ribbon a { 22 | #font > #family > .sans-serif(); 23 | font-size: 13px; 24 | font-weight: 700; 25 | color: white; 26 | 27 | // Set the text properties 28 | text-decoration: none; 29 | text-shadow: 0 -1px rgba(0,0,0,0.5); 30 | text-align: center; 31 | 32 | // Set the geometry. If you fiddle with these you'll also need to tweak the top and right values in #github-fork-ribbon. 33 | width: 200px; 34 | line-height: 20px; 35 | 36 | // Set the layout properties 37 | display: inline-block; 38 | padding: 2px 0; 39 | 40 | // Add "stitching" effect 41 | border-width: 1px 0; 42 | border-style: dotted; 43 | border-color: rgba(255,255,255,0.7); 44 | } 45 | 46 | .github-fork-ribbon-wrapper { 47 | width: 150px; 48 | height: 150px; 49 | position: absolute; 50 | overflow: hidden; 51 | top: 0; 52 | } 53 | 54 | .github-fork-ribbon-wrapper.left { 55 | left: 0; 56 | } 57 | 58 | .github-fork-ribbon-wrapper.right { 59 | right: 0; 60 | } 61 | 62 | .github-fork-ribbon-wrapper.left-bottom { 63 | position: fixed; 64 | top: inherit; 65 | bottom: 0; 66 | left: 0; 67 | } 68 | 69 | .github-fork-ribbon-wrapper.right-bottom { 70 | z-index: 6; 71 | position: fixed; 72 | top: inherit; 73 | bottom: 0; 74 | right: 0; 75 | } 76 | 77 | .github-fork-ribbon-wrapper.right .github-fork-ribbon { 78 | top: 42px; 79 | right: -43px; 80 | 81 | // Rotate the banner 45 degrees 82 | -webkit-transform: rotate(45deg); 83 | -moz-transform: rotate(45deg); 84 | -o-transform: rotate(45deg); 85 | transform: rotate(45deg); 86 | } 87 | 88 | .github-fork-ribbon-wrapper.left .github-fork-ribbon { 89 | // Attach to the left of the page 90 | top: 42px; 91 | left: -43px; 92 | 93 | // Rotate the banner -45 degrees 94 | -webkit-transform: rotate(-45deg); 95 | -moz-transform: rotate(-45deg); 96 | -o-transform: rotate(-45deg); 97 | transform: rotate(-45deg); 98 | } 99 | 100 | 101 | .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon { 102 | // Attach to the left of the page 103 | top: 75px; 104 | left: -64px; 105 | 106 | // Rotate the banner -45 degrees 107 | -webkit-transform: rotate(45deg); 108 | -moz-transform: rotate(45deg); 109 | -o-transform: rotate(45deg); 110 | transform: rotate(45deg); 111 | } 112 | .github-fork-ribbon-wrapper.left-bottom .github-fork-ribbon a { 113 | padding-left: 18px; 114 | } 115 | 116 | .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon { 117 | // Attach to the left of the page 118 | top: 89px; 119 | left: -10px; 120 | 121 | // Rotate the banner -45 degrees 122 | -webkit-transform: rotate(-45deg); 123 | -moz-transform: rotate(-45deg); 124 | -o-transform: rotate(-45deg); 125 | transform: rotate(-45deg); 126 | } 127 | .github-fork-ribbon-wrapper.right-bottom .github-fork-ribbon a { 128 | padding-left: 15px; 129 | } -------------------------------------------------------------------------------- /cm/doc/upgrade_v2.2.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Upgrading to v2.2 6 | 7 | 8 | 9 | 10 | 11 |

{ } CodeMirror

12 | 13 |
14 | 15 |
16 | /* Upgrading to
17 |    v2.2 */
18 | 
19 |
20 | 21 |
22 | 23 |

There are a few things in the 2.2 release that require some care 24 | when upgrading.

25 | 26 |

No more default.css

27 | 28 |

The default theme is now included 29 | in codemirror.css, so 30 | you do not have to included it separately anymore. (It was tiny, so 31 | even if you're not using it, the extra data overhead is negligible.) 32 | 33 |

Different key customization

34 | 35 |

CodeMirror has moved to a system 36 | where keymaps are used to 37 | bind behavior to keys. This means custom 38 | bindings are now possible.

39 | 40 |

Three options that influenced key 41 | behavior, tabMode, enterMode, 42 | and smartHome, are no longer supported. Instead, you can 43 | provide custom bindings to influence the way these keys act. This is 44 | done through the 45 | new extraKeys 46 | option, which can hold an object mapping key names to functionality. A 47 | simple example would be:

48 | 49 |
  extraKeys: {
50 |     "Ctrl-S": function(instance) { saveText(instance.getValue()); },
51 |     "Ctrl-/": "undo"
52 |   }
53 | 54 |

Keys can be mapped either to functions, which will be given the 55 | editor instance as argument, or to strings, which are mapped through 56 | functions through the CodeMirror.commands table, which 57 | contains all the built-in editing commands, and can be inspected and 58 | extended by external code.

59 | 60 |

By default, the Home key is bound to 61 | the "goLineStartSmart" command, which moves the cursor to 62 | the first non-whitespace character on the line. You can set do this to 63 | make it always go to the very start instead:

64 | 65 |
  extraKeys: {"Home": "goLineStart"}
66 | 67 |

Similarly, Enter is bound 68 | to "newlineAndIndent" by default. You can bind it to 69 | something else to get different behavior. To disable special handling 70 | completely and only get a newline character inserted, you can bind it 71 | to false:

72 | 73 |
  extraKeys: {"Enter": false}
74 | 75 |

The same works for Tab. If you don't want CodeMirror 76 | to handle it, bind it to false. The default behaviour is 77 | to indent the current line more ("indentMore" command), 78 | and indent it less when shift is held ("indentLess"). 79 | There are also "indentAuto" (smart indent) 80 | and "insertTab" commands provided for alternate 81 | behaviors. Or you can write your own handler function to do something 82 | different altogether.

83 | 84 |

Tabs

85 | 86 |

Handling of tabs changed completely. The display width of tabs can 87 | now be set with the tabSize option, and tabs can 88 | be styled by setting CSS rules 89 | for the cm-tab class.

90 | 91 |

The default width for tabs is now 4, as opposed to the 8 that is 92 | hard-wired into browsers. If you are relying on 8-space tabs, make 93 | sure you explicitly set tabSize: 8 in your options.

94 | 95 |
96 | 97 | 98 | 99 | -------------------------------------------------------------------------------- /cm/demo/collapserange.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CodeMirror: Range Collapsing Demo 6 | 7 | 8 | 9 | 10 | 11 | 12 | 16 | 17 | 18 |

CodeMirror: Range Collapsing Demo

19 | 20 |
89 | 90 | 97 | 98 |

Click on the right side of the gutter, then click again below, 99 | the code between will collapse. Click on either arrow to expand. 100 | To use, simply include the collapserange.js file and 101 | set collapseRange: true in options.

102 | 103 | 104 | 105 | -------------------------------------------------------------------------------- /public/javascripts/vendor/cm/addon/edit/matchbrackets.js: -------------------------------------------------------------------------------- 1 | (function() { 2 | var ie_lt8 = /MSIE \d/.test(navigator.userAgent) && 3 | (document.documentMode == null || document.documentMode < 8); 4 | 5 | var Pos = CodeMirror.Pos; 6 | 7 | var matching = {"(": ")>", ")": "(<", "[": "]>", "]": "[<", "{": "}>", "}": "{<"}; 8 | function findMatchingBracket(cm, where, strict) { 9 | var state = cm.state.matchBrackets; 10 | var maxScanLen = (state && state.maxScanLineLength) || 10000; 11 | 12 | var cur = where || cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1; 13 | var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)]; 14 | if (!match) return null; 15 | var forward = match.charAt(1) == ">", d = forward ? 1 : -1; 16 | if (strict && forward != (pos == cur.ch)) return null; 17 | var style = cm.getTokenTypeAt(Pos(cur.line, pos + 1)); 18 | 19 | var stack = [line.text.charAt(pos)], re = /[(){}[\]]/; 20 | function scan(line, lineNo, start) { 21 | if (!line.text) return; 22 | var pos = forward ? 0 : line.text.length - 1, end = forward ? line.text.length : -1; 23 | if (line.text.length > maxScanLen) return null; 24 | if (start != null) pos = start + d; 25 | for (; pos != end; pos += d) { 26 | var ch = line.text.charAt(pos); 27 | if (re.test(ch) && cm.getTokenTypeAt(Pos(lineNo, pos + 1)) == style) { 28 | var match = matching[ch]; 29 | if (match.charAt(1) == ">" == forward) stack.push(ch); 30 | else if (stack.pop() != match.charAt(0)) return {pos: pos, match: false}; 31 | else if (!stack.length) return {pos: pos, match: true}; 32 | } 33 | } 34 | } 35 | for (var i = cur.line, found, e = forward ? Math.min(i + 100, cm.lineCount()) : Math.max(-1, i - 100); i != e; i+=d) { 36 | if (i == cur.line) found = scan(line, i, pos); 37 | else found = scan(cm.getLineHandle(i), i); 38 | if (found) break; 39 | } 40 | return {from: Pos(cur.line, pos), to: found && Pos(i, found.pos), 41 | match: found && found.match, forward: forward}; 42 | } 43 | 44 | function matchBrackets(cm, autoclear) { 45 | // Disable brace matching in long lines, since it'll cause hugely slow updates 46 | var maxHighlightLen = cm.state.matchBrackets.maxHighlightLineLength || 1000; 47 | var found = findMatchingBracket(cm); 48 | if (!found || cm.getLine(found.from.line).length > maxHighlightLen || 49 | found.to && cm.getLine(found.to.line).length > maxHighlightLen) 50 | return; 51 | 52 | var style = found.match ? "CodeMirror-matchingbracket" : "CodeMirror-nonmatchingbracket"; 53 | var one = cm.markText(found.from, Pos(found.from.line, found.from.ch + 1), {className: style}); 54 | var two = found.to && cm.markText(found.to, Pos(found.to.line, found.to.ch + 1), {className: style}); 55 | // Kludge to work around the IE bug from issue #1193, where text 56 | // input stops going to the textare whever this fires. 57 | if (ie_lt8 && cm.state.focused) cm.display.input.focus(); 58 | var clear = function() { 59 | cm.operation(function() { one.clear(); two && two.clear(); }); 60 | }; 61 | if (autoclear) setTimeout(clear, 800); 62 | else return clear; 63 | } 64 | 65 | var currentlyHighlighted = null; 66 | function doMatchBrackets(cm) { 67 | cm.operation(function() { 68 | if (currentlyHighlighted) {currentlyHighlighted(); currentlyHighlighted = null;} 69 | if (!cm.somethingSelected()) currentlyHighlighted = matchBrackets(cm, false); 70 | }); 71 | } 72 | 73 | CodeMirror.defineOption("matchBrackets", false, function(cm, val, old) { 74 | if (old && old != CodeMirror.Init) 75 | cm.off("cursorActivity", doMatchBrackets); 76 | if (val) { 77 | cm.state.matchBrackets = typeof val == "object" ? val : {}; 78 | cm.on("cursorActivity", doMatchBrackets); 79 | } 80 | }); 81 | 82 | CodeMirror.defineExtension("matchBrackets", function() {matchBrackets(this, true);}); 83 | CodeMirror.defineExtension("findMatchingBracket", function(pos, strict){ 84 | return findMatchingBracket(this, pos, strict); 85 | }); 86 | })(); 87 | --------------------------------------------------------------------------------