Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
css-sprite
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Toolchain
css-sprite
Commits
13b03e26
Commit
13b03e26
authored
11 years ago
by
Alexander Slansky
Browse files
Options
Downloads
Patches
Plain Diff
adds watch option to cli
parent
b92132d7
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
.gitignore
+1
-0
1 addition, 0 deletions
.gitignore
bin/cli.js
+41
-22
41 additions, 22 deletions
bin/cli.js
package.json
+2
-1
2 additions, 1 deletion
package.json
readme.md
+6
-5
6 additions, 5 deletions
readme.md
sprite.png
+0
-0
0 additions, 0 deletions
sprite.png
with
50 additions
and
28 deletions
.gitignore
+
1
−
0
View file @
13b03e26
...
...
@@ -3,3 +3,4 @@ coverage
.DS_Store
*.log
build
test/dist
This diff is collapsed.
Click to expand it.
bin/cli.js
+
41
−
22
View file @
13b03e26
...
...
@@ -2,36 +2,34 @@
'
use strict
'
;
var
sprite
=
require
(
'
../index
'
);
var
gaze
=
require
(
'
gaze
'
);
var
opts
=
require
(
'
nomnom
'
)
.
option
(
'
src
'
,
{
position
:
0
,
abbr
:
'
s
'
,
required
:
true
,
list
:
true
,
metavar
:
'
GLOB
'
,
help
:
'
glob strings to find source images to put into the sprite
'
})
.
option
(
'
out
'
,
{
position
:
0
,
abbr
:
'
o
'
,
required
:
true
,
metavar
:
'
DIR
'
,
default
:
process
.
cwd
(),
help
:
'
path of directory to write sprite file to
'
})
.
option
(
'
name
'
,
{
abbr
:
'
n
'
,
default
:
'
sprite.png
'
,
help
:
'
name of the sprite file
'
})
.
option
(
'
style
'
,
{
abbr
:
'
st
'
,
help
:
'
file to write css to, if ommited no css is written
'
.
option
(
'
src
'
,
{
position
:
1
,
abbr
:
'
s
'
,
required
:
true
,
list
:
true
,
metavar
:
'
GLOB
'
,
help
:
'
glob strings to find source images to put into the sprite
'
})
.
option
(
'
cssPath
'
,
{
abbr
:
'
c
'
,
full
:
'
css-image-path
'
,
default
:
'
../images
'
,
help
:
'
http path to images on the web server (relative to css path or absolute)
'
help
:
'
http path to images on the web server (relative to css path or absolute path)
'
})
.
option
(
'
name
'
,
{
abbr
:
'
n
'
,
default
:
'
sprite.png
'
,
help
:
'
name of the sprite file
'
})
.
option
(
'
processor
'
,
{
abbr
:
'
p
'
,
...
...
@@ -39,16 +37,37 @@ var opts = require('nomnom')
default
:
'
css
'
,
help
:
'
output format of the css. one of css, less, sass, scss or stylus
'
})
.
option
(
'
orientation
'
,
{
choices
:
[
'
vertical
'
,
'
horizontal
'
],
default
:
'
vertical
'
,
help
:
'
orientation of the sprite image
'
.
option
(
'
style
'
,
{
abbr
:
'
st
'
,
help
:
'
file to write css to, if ommited no css is written
'
})
.
option
(
'
watch
'
,
{
abbr
:
'
w
'
,
flag
:
true
,
help
:
'
continuously create sprite
'
})
.
option
(
'
margin
'
,
{
default
:
5
,
help
:
'
margin in px between tiles
'
})
.
option
(
'
orientation
'
,
{
choices
:
[
'
vertical
'
,
'
horizontal
'
],
default
:
'
vertical
'
,
help
:
'
orientation of the sprite image
'
})
.
script
(
'
css-sprite
'
)
.
parse
();
sprite
.
create
(
opts
);
if
(
opts
.
watch
)
{
gaze
(
opts
.
src
,
function
()
{
console
.
log
(
'
Watching for file changes ...
'
)
this
.
on
(
'
all
'
,
function
()
{
sprite
.
create
(
opts
,
function
()
{
console
.
log
(
'
> Sprite created in
'
+
opts
.
out
);
});
});
});
}
else
{
sprite
.
create
(
opts
);
}
This diff is collapsed.
Click to expand it.
package.json
+
2
−
1
View file @
13b03e26
...
...
@@ -56,7 +56,8 @@
"
vinyl
"
:
"
~0.2.3
"
,
"
event-stream
"
:
"
~3.1.0
"
,
"
graceful-fs
"
:
"
~2.0.1
"
,
"
mkdirp
"
:
"
~0.3.5
"
"
mkdirp
"
:
"
~0.3.5
"
,
"
gaze
"
:
"
~0.5.0
"
},
"devDependencies"
:
{
"
mocha
"
:
"
~1.17.0
"
,
...
...
This diff is collapsed.
Click to expand it.
readme.md
+
6
−
5
View file @
13b03e26
...
...
@@ -29,18 +29,19 @@ npm install css-sprite -g
## Command Line Interface
```
Usage: css-sprite <src>... [options]
Usage: css-sprite
<out>
<src>... [options]
out path of directory to write sprite file to
src glob strings to find source images to put into the sprite
Options:
-
o DIR, --out DIR path of directory to write sprite file to [process.cwd()
]
-
c, --css-image-path http path to images on the web server (relative to css path or absolute path) [../images
]
-n, --name name of the sprite file [sprite.png]
-st, --style file to write css to, if ommited no css is written
-c, --css-image-path http path to images on the web server (relative to css path or absolute) [../images]
-p, --processor output format of the css. one of css, less, sass, scss or stylus [css]
--orientation orientation of the sprite image [vertical]
-st, --style file to write css to, if ommited no css is written
-w, --watch continuously create sprite
--margin margin in px between tiles [5]
--orientation orientation of the sprite image [vertical]
```
## Programatic usage
...
...
This diff is collapsed.
Click to expand it.
sprite.png
deleted
100644 → 0
+
0
−
0
View file @
b92132d7
1.78 KiB
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment