Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
adam.huang
Ohmyzsh
Commits
91303246
Commit
91303246
authored
Sep 07, 2012
by
mikka
Browse files
added lesscss plugin
parent
3ef82a90
Changes
1
Hide whitespace changes
Inline
Side-by-side
plugins/lesscss/lesscss.plugin.zsh
0 → 100644
View file @
91303246
# basics taken from here:
# http://www.ravelrumba.com/blog/watch-compile-less-command-line/comment-page-1/#comment-2464
# Requires watchr: https://github.com/mynyml/watchr
watchless
()
{
compressed
=
0
compile
=
""
while
getopts
":xc:h"
option
do
case
$option
in
x
)
compressed
=
1
;;
c
)
compile
=
$OPTARG
;;
h
)
_watchless_usage
;
return
;;
esac
done
if
[
$compressed
-eq
1
]
;
then
x
=
' -x'
else
x
=
''
fi
if
[
-n
"
$compile
"
]
;
then
if
[
!
-e
$compile
]
;
then
echo
"
\0
33[337;41m
\n
$compile
doesn't exist!
\n\0
33[0m"
return
fi
name
=
$(
echo
$compile
|
cut
-d
.
-f
1
)
watchr
-e
'watch(".*\.less$") { |f| system("lessc '
$name
'.less > '
$name
'.css'
$x
' && echo \"'
$name
'.less > '
$name
'.css\" ") }'
else
watchr
-e
'watch(".*\.less$") { |f| system("lessc #{f[0]} > $(echo #{f[0]} | cut -d\. -f1).css'
$x
' && echo \"#{f[0]} > $(echo #{f[0]} | cut -d\. -f1).css\" ") }'
fi
}
_watchless_usage
()
{
echo
"Usage: watchless [options]"
echo
echo
"Options"
echo
" -x Compiles less files into minified css files"
echo
" -c Watch all files but compile only the one given here"
echo
" -h Get this help message"
return
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment