Skip to content

Commit 693c60c

Browse files
committed
Merge branch 'dev/v2'
2 parents 088aefa + 7dd6471 commit 693c60c

File tree

172 files changed

+39995
-3807
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

172 files changed

+39995
-3807
lines changed

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# Change Logs
2+
3+
# v2.0.0
4+
5+
- rename `css-spinner` to `@loadingio/css-spinner` since the old name conflicts.
6+
- correct box-sizing model in every spinner
7+
- fix ripple and heart spinner alignment
8+
- add mixin.pug
9+
- use currentColor for spinner color
10+
- add `style` field in package.json
11+
- support attributes in mixin

README.md

Lines changed: 20 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,72 +1,58 @@
1-
# CSS-Spinner
1+
# css-spinner
22

33
[Live Demo](https://loading.io/css/)
44

5-
collection of 12 small, elegant pure css spinners for your website loading animation.
5+
Collection of 12 small, elegant pure css spinners for your website's loading animation.
66

7-
![css spinner](https://github.com/loadingio/css-spinner/blob/master/thumbnail.gif?raw=true)
7+
![css spinner](https://raw.githubusercontent.com/loadingio/css-spinner/master/web/static/thumbnail.gif)
88

99

1010
## Features
1111

1212
* vanilla - no external dependency and no additional library required.
1313
* standalone - use any of them separately.
14-
* customizable - use Stylus variables to quickly customize them to fit your need.
15-
* easy to use - simple as copy and paste while also simple to use with pug mixins.
14+
* customizable - use Stylus variables to quickly customize them to fit your needs.
15+
* easy to use - simply copy & paste while also easy to use with pug mixins.
1616
* small - average size 1K per spinner unminimized, unzipped
1717

1818
## Usage
1919

20-
[loading.io](https://loading.io/css/) provides a [web interface](https://loading.io/css/) to quickly choose and copy your desired spinners, yet you can still find the source code in this repository. The simplest usage is as:
20+
[loading.io](https://loading.io/) provides a [web interface](https://loading.io/css/) to quickly choose and copy your desired spinners, yet you can still find the source code in this repository. The basic usage is as:
2121

22-
1. Find and download the html file of desired loader under [build/](https://github.com/loadingio/css-spinner/tree/master/build) folder.
22+
1. Find and download the html files of desired loader under [dist](https://github.com/loadingio/css-spinner/tree/master/dist/) folder.
2323
2. Copy its content to the place you want to use this loader.
24-
3. Done.
2524

26-
Separated CSS and HTML files are also available under [build](https://github.com/loadingio/css-spinner/tree/master/build) folder so that you can reuse the css to reduce payload size.
25+
Separated CSS and HTML files are also available under [build](https://github.com/loadingio/css-spinner/tree/master/dist/entries) folder for reusing CSS codes to reduce payload size.
2726

2827
We also provide stylus and pug source files for better integrating these spinners into your project. Find corresponding stylus and pug files for your desired spinners under [src/](https://github.com/loadingio/css-spinner/tree/master/src) folders.
2928

30-
Additionally, you will need [vars.styl](https://github.com/loadingio/css-spinner/blob/master/vars.styl) and [basic.styl](https://github.com/loadingio/css-spinner/blob/master/basic.styl) if you are going to build by yourself. See following section for more detail.
29+
To use stylus files alone, you will have to provide variables listed in [vars.styl](https://github.com/loadingio/css-spinner/blob/master/vars.styl).
3130

3231

33-
## Customization
32+
## Build
3433

35-
To customize speed and color of a loader, first ensure you have stylus install locally ( you will need npm too ):
34+
You can also customize all these loaders by building them yourself.
3635

37-
npm install -g stylus
36+
* First, update `vars.styl` based on your needs.
37+
* make sure required packages are installed by `npm install`. You will need NPM / NodeJS pre-installed.
38+
* build with this command: `npm run build`
39+
- generated files will be in `dist/` folder.
3840

3941

40-
then, edit vars.styl with your desired configuration. for now you can edit the following style of a spinner:
41-
42-
* size
43-
* color
44-
* speed
45-
46-
47-
once you've done with the editing, run stylus to build yourself a css file:
48-
49-
stylus -o . --import vars.styl --import basic.styl src/<desired-loader>/main.styl
50-
51-
52-
use the generated main.css together with build/<desired-loader>/main.html to add this loader in your project.
53-
54-
55-
Browser Compatibility
56-
----------------
42+
## Browser Compatibility
5743

5844
These spinners use CSS Animation and Transformation which is widely supported by major modern browsers except IE<=9. To support older browsers like IE9, please use [loading.io](https://loading.io/animation/icon/) to generate alternative GIF Loaders instead.
5945

6046

6147

62-
License
63-
----------------
48+
## License
6449

6550
All loader files here are released under CC0 License. However, you could attribute to this link: [loading.io css spinner ( https://loading.io/css/ )](https://loading.io/css/) to give loading.io a thumbs-up.
6651

52+
Other source codes are released under MIT License.
53+
6754

68-
Other Resources
69-
----------------
55+
## Other Resources
7056

7157
If you want to make custom css loading animation, loading.io also provides [loading.css](https://loading.io/animation/) - A pure CSS loading animation library, and a [helper GIF builder](https://loading.io/animation/icon/). Don't forget to check it out and share your customized loader with us!
7258

build.ls

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
require! <[fs fs-extra progress colors stylus pug uglifycss]>
2+
3+
console.log "Build all CSS-spinners..."
4+
5+
progress-bar = (total = 10, text = "converting") ->
6+
bar = new progress(
7+
" #text [#{':bar'.yellow}] #{':percent'.cyan} :etas",
8+
{ total: total, width: 60, complete: '#' }
9+
)
10+
11+
spinners = fs.readdir-sync \src/
12+
.filter -> fs.lstat-sync "src/#it" .is-directory!
13+
14+
bar = progress-bar spinners.length, "Build Spinners"
15+
vars = fs.read-file-sync "vars.styl" .toString!
16+
all-css = ""
17+
all-pug = ""
18+
19+
spinners.map ->
20+
src = do
21+
stylus: [vars, fs.read-file-sync("src/#it/index.styl").toString!].join(\\n)
22+
pug: fs.read-file-sync "src/#it/index.pug" .toString!
23+
css = stylus src.stylus .render!
24+
css-min = uglifycss.processString(css, uglyComments: true)
25+
all-css += css
26+
html = pug.render src.pug
27+
html-css = """
28+
<style type="text/css">
29+
#css
30+
</style>
31+
#html
32+
"""
33+
fs-extra.ensure-dir-sync "dist/entries/#it"
34+
fs.write-file-sync "dist/entries/#it/index.css", css
35+
fs.write-file-sync "dist/entries/#it/index.min.css", css-min
36+
fs.write-file-sync "dist/entries/#it/index.html", html
37+
fs.write-file-sync "dist/#it.html", html-css
38+
mixin-pug = src.pug.replace /^([^: ]+)([: ])/, "$1&attributes(attributes)$2"
39+
all-pug += """
40+
mixin lds-#it()
41+
#{mixin-pug.split(\\n).filter(->it).map(->" #it").join(\\n)}\n
42+
"""
43+
bar.tick!
44+
45+
all-css-min = uglifycss.processString(all-css, uglyComments: true)
46+
fs.write-file-sync "dist/index.css", all-css
47+
fs.write-file-sync "dist/index.min.css", all-css-min
48+
fs.write-file-sync "dist/mixin.pug", all-pug
49+
fs-extra.ensure-dir-sync "web/static/assets/lib/css-spinner/dev"
50+
fs.write-file-sync "web/static/assets/lib/css-spinner/dev/index.css", all-css
51+
fs.write-file-sync "web/static/assets/lib/css-spinner/dev/index.min.css", all-css-min
52+
fs.write-file-sync "web/static/assets/lib/css-spinner/dev/mixin.pug", all-pug
53+
console.log "\nFinished."

build/circle/sample.html

Lines changed: 0 additions & 32 deletions
This file was deleted.

build/default/sample.html

Lines changed: 0 additions & 86 deletions
This file was deleted.

build/dual-ring/sample.html

Lines changed: 0 additions & 28 deletions
This file was deleted.

build/ellipsis/sample.html

Lines changed: 0 additions & 59 deletions
This file was deleted.

0 commit comments

Comments
 (0)