Adds less (CSS processor) v1.7.4 (Apache v2)

Change-Id: I364e46d395c0752df8c585a5aeab3aa9a289162c
This commit is contained in:
Lindsey Simon 2014-09-03 22:21:29 -07:00
parent 37e38ad8b9
commit ffb660b54d
4 changed files with 51 additions and 2 deletions

View File

@ -391,7 +391,7 @@ func buildSrcPath(fromSrc string) string {
// kept in between runs.
func genEmbeds() error {
cmdName := exeName(filepath.Join(buildGoPath, "bin", "genfileembed"))
for _, embeds := range []string{"server/camlistored/ui", "pkg/server", "third_party/react", "third_party/glitch", "third_party/fontawesome", "app/publisher"} {
for _, embeds := range []string{"server/camlistored/ui", "pkg/server", "third_party/react", "third_party/less", "third_party/glitch", "third_party/fontawesome", "app/publisher"} {
embeds := buildSrcPath(embeds)
args := []string{"--output-files-stderr", embeds}
cmd := exec.Command(cmdName, args...)

View File

@ -47,10 +47,11 @@ import (
fontawesomestatic "camlistore.org/third_party/fontawesome"
glitchstatic "camlistore.org/third_party/glitch"
reactstatic "camlistore.org/third_party/react"
lessstatic "camlistore.org/third_party/less"
)
var (
staticFilePattern = regexp.MustCompile(`^([a-zA-Z0-9\-\_]+\.(html|js|css|png|jpg|gif|svg))$`)
staticFilePattern = regexp.MustCompile(`^([a-zA-Z0-9\-\_\.]+\.(html|js|css|png|jpg|gif|svg))$`)
identOrDotPattern = regexp.MustCompile(`^[a-zA-Z\_]+(\.[a-zA-Z\_]+)*$`)
// Download URL suffix:
@ -62,6 +63,7 @@ var (
thumbnailPattern = regexp.MustCompile(`^thumbnail/([^/]+)(/.*)?$`)
treePattern = regexp.MustCompile(`^tree/([^/]+)(/.*)?$`)
closurePattern = regexp.MustCompile(`^closure/(([^/]+)(/.*)?)$`)
lessPattern = regexp.MustCompile(`^less/(.+)$`)
reactPattern = regexp.MustCompile(`^react/(.+)$`)
fontawesomePattern = regexp.MustCompile(`^fontawesome/(.+)$`)
glitchPattern = regexp.MustCompile(`^glitch/(.+)$`)
@ -101,6 +103,7 @@ type UIHandler struct {
uiDir string // if sourceRoot != "", this is sourceRoot+"/server/camlistored/ui"
closureHandler http.Handler
fileLessHandler http.Handler
fileReactHandler http.Handler
fileFontawesomeHandler http.Handler
fileGlitchHandler http.Handler
@ -440,6 +443,8 @@ func (ui *UIHandler) ServeHTTP(rw http.ResponseWriter, req *http.Request) {
ui.serveQR(rw, req)
case getSuffixMatches(req, closurePattern):
ui.serveClosure(rw, req)
case getSuffixMatches(req, lessPattern):
ui.serveFromDiskOrStatic(rw, req, lessPattern, ui.fileLessHandler, lessstatic.Files)
case getSuffixMatches(req, reactPattern):
ui.serveFromDiskOrStatic(rw, req, reactPattern, ui.fileReactHandler, reactstatic.Files)
case getSuffixMatches(req, glitchPattern):

28
third_party/less/fileembed.go vendored Normal file
View File

@ -0,0 +1,28 @@
/*
Copyright 2014 The Camlistore Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
*/
/*
Package less provides the LESS CSS framework/rewriter.
See http://lesscss.org/
#fileembed pattern .*\.js$
*/
package less
import "camlistore.org/pkg/fileembed"
var Files = &fileembed.Files{}

16
third_party/less/less.js vendored Normal file

File diff suppressed because one or more lines are too long