Skip to content

Commit 695def1

Browse files
change readme according to evrone guidelines
1 parent bf89798 commit 695def1

File tree

5 files changed

+180
-49
lines changed

5 files changed

+180
-49
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

CODE-OF-CONDUCT.md

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
## Code of Conduct
2+
3+
### Our Pledge
4+
5+
In the interest of fostering an open and welcoming environment, we as
6+
contributors and maintainers pledge to making participation in our project and
7+
our community a harassment-free experience for everyone, regardless of age, body
8+
size, disability, ethnicity, gender identity and expression, level of experience,
9+
nationality, personal appearance, race, religion, or sexual identity and
10+
orientation.
11+
12+
### Our Standards
13+
14+
Examples of behavior that contributes to creating a positive environment
15+
include:
16+
17+
* Using welcoming and inclusive language
18+
* Being respectful of differing viewpoints and experiences
19+
* Gracefully accepting constructive criticism
20+
* Focusing on what is best for the community
21+
* Showing empathy towards other community members
22+
23+
Examples of unacceptable behavior by participants include:
24+
25+
* The use of sexualized language or imagery and unwelcome sexual attention or
26+
advances
27+
* Trolling, insulting/derogatory comments, and personal or political attacks
28+
* Public or private harassment
29+
* Publishing others' private information, such as a physical or electronic
30+
address, without explicit permission
31+
* Other conduct which could reasonably be considered inappropriate in a
32+
professional setting
33+
34+
### Our Responsibilities
35+
36+
Project maintainers are responsible for clarifying the standards of acceptable
37+
behavior and are expected to take appropriate and fair corrective action in
38+
response to any instances of unacceptable behavior.
39+
40+
Project maintainers have the right and responsibility to remove, edit, or
41+
reject comments, commits, code, wiki edits, issues, and other contributions
42+
that are not aligned to this Code of Conduct, or to ban temporarily or
43+
permanently any contributor for other behaviors that they deem inappropriate,
44+
threatening, offensive, or harmful.
45+
46+
### Scope
47+
48+
This Code of Conduct applies both within project spaces and in public spaces
49+
when an individual is representing the project or its community. Examples of
50+
representing a project or community include using an official project e-mail
51+
address, posting via an official social media account, or acting as an appointed
52+
representative at an online or offline event. Representation of a project may be
53+
further defined and clarified by project maintainers.
54+
55+
### Enforcement
56+
57+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
58+
reported by contacting the project team at codeofconduct@evrone.com. All
59+
complaints will be reviewed and investigated and will result in a response that
60+
is deemed necessary and appropriate to the circumstances. The project team is
61+
obligated to maintain confidentiality with regard to the reporter of an incident.
62+
Further details of specific enforcement policies may be posted separately.
63+
64+
Project maintainers who do not follow or enforce the Code of Conduct in good
65+
faith may face temporary or permanent repercussions as determined by other
66+
members of the project's leadership.
67+
68+
### Attribution
69+
70+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71+
available at [http://contributor-covenant.org/version/1/4][version]
72+
73+
[homepage]: http://contributor-covenant.org
74+
[version]: http://contributor-covenant.org/version/1/4/

CONTRIBUTING.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Contributing Guidelines
2+
3+
Thanks for taking the time to contribute!
4+
5+
The following is a set of guidelines for contributing to this project. These are just guidelines, not rules, so use your best judgement and feel free to propose changes to this document in a pull request.
6+
7+
## Reporting issues
8+
9+
Ensure the bug was not already reported by searching on GitHub under issues. If you're unable to find an open issue addressing the bug, open a new issue.
10+
11+
Please pay attention to the following points while opening an issue:
12+
* How to reproduce the issue, step-by-step.
13+
* The expected behavior (or what is wrong).
14+
* Screenshots for GUI issues.
15+
* The application version.
16+
* The operating system.
17+
18+
## Pull Requests
19+
20+
Pull Requests are always welcome.
21+
22+
1. When you edit the code, please check the formatting of your code before you `git commit`.
23+
2. Ensure the PR description clearly describes the problem and solution. It should include:
24+
* The operating system on which you tested.
25+
* The relevant issue number, if applicable.

LICENSE

100755100644
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
The MIT License (MIT)
1+
MIT License
22

3-
Copyright (c) 2016 Dmitry Karpunin <koderfunk@gmail.com>
3+
Copyright (c) [year||from_year-to_year] [author's fullname]
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal
@@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
1818
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21-
SOFTWARE.
21+
SOFTWARE.

README.md

Lines changed: 73 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,20 @@
1-
# postcss-px-to-viewport [![NPM version](https://badge.fury.io/js/postcss-px-to-viewport.svg)](http://badge.fury.io/js/postcss-px-to-viewport)
1+
# postcss-px-to-viewport
2+
[![NPM version](https://badge.fury.io/js/postcss-px-to-viewport.svg)](http://badge.fury.io/js/postcss-px-to-viewport)
23

34
A plugin for [PostCSS](https://github.com/postcss/postcss) that generates viewport units (vw, vh, vmin, vmax) from pixel units.
45

5-
Feel free to start watching and ⭐ project in order not miss the release or updates.
6-
76
<a href="https://evrone.com/?utm_source=postcss-px-to-viewport">
87
<img src="https://user-images.githubusercontent.com/417688/34437029-dbfe4ee6-ecab-11e7-9d80-2b274b4149b3.png"
98
alt="Sponsored by Evrone" width="231">
109
</a>
1110

12-
## Install
13-
```
14-
$ npm install postcss-px-to-viewport --save-dev
15-
```
16-
17-
## Usage
11+
## Demo
1812

1913
If your project involves a fixed width, this script will help to convert pixels into viewport units.
2014

21-
### Input/Output
15+
### Input
2216

2317
```css
24-
// input
25-
2618
.class {
2719
margin: -10px .5vh;
2820
padding: 5vmin 9.5px 1px;
@@ -45,9 +37,10 @@ If your project involves a fixed width, this script will help to convert pixels
4537
line-height: 22px;
4638
}
4739
}
40+
```
4841

49-
// output
50-
42+
### Output
43+
```css
5144
.class {
5245
margin: -3.125vw .5vh;
5346
padding: 5vmin 2.96875vw 1px;
@@ -64,58 +57,49 @@ If your project involves a fixed width, this script will help to convert pixels
6457
line-height: 9.375vw;
6558
}
6659

67-
@media (min-width: 234.375vw) {
60+
@media (min-width: 750px) {
6861
.class3 {
69-
font-size: 5vw;
70-
line-height: 6.875vw;
62+
font-size: 16px;
63+
line-height: 22px;
7164
}
7265
}
7366
```
7467

75-
### Example
68+
## Getting Started
7669

77-
```js
78-
'use strict';
79-
80-
var fs = require('fs');
81-
var postcss = require('postcss');
82-
var pxToViewport = require('..');
83-
var css = fs.readFileSync('main.css', 'utf8');
84-
var options = {
85-
replace: false
86-
};
87-
var processedCss = postcss(pxToViewport(options)).process(css).css;
88-
89-
fs.writeFile('main-viewport.css', processedCss, function (err) {
90-
if (err) {
91-
throw err;
92-
}
93-
console.log('File with viewport units written.');
94-
});
70+
### Installation
71+
Add via npm
72+
```
73+
$ npm install postcss-px-to-viewport --save-dev
74+
```
75+
or yarn
76+
```
77+
$ yarn add postcss-px-to-viewport
9578
```
9679

97-
### Options
80+
### Usage
9881

99-
Default:
82+
Default Options:
10083
```js
10184
{
10285
unitToConvert: 'px',
10386
viewportWidth: 320,
104-
viewportHeight: 568, // not now used; TODO: need for different units and math for different properties
10587
unitPrecision: 5,
10688
propList: ['*'],
10789
viewportUnit: 'vw',
108-
fontViewportUnit: 'vw', // vmin is more suitable.
90+
fontViewportUnit: 'vw',
10991
selectorBlackList: [],
11092
minPixelValue: 1,
11193
mediaQuery: false,
11294
replace: true,
113-
exclude: [] // ignore some files
95+
exclude: [],
96+
landscape: false,
97+
landscapeUnit: 'vw',
98+
landscapeWidth: 568
11499
}
115100
```
116101
- `unitToConvert` (String) unit to convert, by default, it is px.
117102
- `viewportWidth` (Number) The width of the viewport.
118-
- `viewportHeight` (Number) The height of the viewport.
119103
- `unitPrecision` (Number) The decimal numbers to allow the vw units to grow to.
120104
- `propList` (Array) The properties that can change from px to vw.
121105
- Values need to be exact matches.
@@ -136,9 +120,13 @@ Default:
136120
- `exclude` (Array or Regexp) Ignore some files like 'node_modules'
137121
- If value is regexp, will ignore the matches files.
138122
- If value is array, the elements of the array are regexp.
123+
- `landscape` (Boolean) Adds `@media (orientation: landscape)` with values converted via `landscapeWidth`.
124+
- `landscapeUnit` (String) Expected unit for `landscape` option
125+
- `landscapeWidth` (Number) Viewport width for landscape orientation.
139126

140-
### Use with gulp-postcss
141-
add to your gulp config:
127+
#### Use with gulp-postcss
128+
129+
add to your `gulpfile.js`:
142130
```js
143131
var gulp = require('gulp');
144132
var postcss = require('gulp-postcss');
@@ -158,8 +146,10 @@ gulp.task('css', function () {
158146
.pipe(gulp.dest('build/css'));
159147
});
160148
```
161-
### Use with Postcss configuration file
162-
add to postcss.config.js
149+
150+
#### Use with PostCss configuration file
151+
152+
add to your `postcss.config.js`
163153
```js
164154
module.exports = {
165155
plugins: {
@@ -170,3 +160,40 @@ module.exports = {
170160
}
171161
}
172162
```
163+
164+
## Running the tests
165+
166+
In order to run tests, you need to install `jasmine-node` globally:
167+
```
168+
$ npm install jasmine-node -g
169+
```
170+
Then run the tests via npm script:
171+
```
172+
$ npm run test
173+
```
174+
175+
## Contributing
176+
177+
Please read [Code of Conduct](CODE-OF-CONDUCT.md) and [Contributing Guidelines](CONTRIBUTING.md) for submitting pull requests to us.
178+
179+
## Versioning
180+
181+
We use [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/evrone/postcss-px-to-viewport/tags).
182+
183+
## Changelog
184+
185+
The changelog is [here](CHANGELOG.md).
186+
187+
## Authors
188+
189+
* [Dmitry Karpunin](https://github.com/KODerFunk) - *Initial work*
190+
191+
See also the list of [contributors](https://github.com/evrone/postcss-px-to-viewport/contributors) who participated in this project.
192+
193+
## License
194+
195+
This project is licensed under the [MIT License](LICENSE).
196+
197+
## Acknowledgments
198+
199+
* Hat tip to https://github.com/cuth/postcss-pxtorem/ for inspiring us for this project.

0 commit comments

Comments
 (0)