Browse Source
Merge pull request #25 from evrone/add-media-landscape
Merge pull request #25 from evrone/add-media-landscape
Add media landscapepull/26/head

committed by
GitHub

No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
13 changed files with 554 additions and 258 deletions
-
1.gitignore
-
26CHANGELOG.md
-
74CODE-OF-CONDUCT.md
-
25CONTRIBUTING.md
-
6LICENSE
-
120README.md
-
6example/index.js
-
4example/main-viewport.css
-
147index.js
-
2package.json
-
235spec/px-to-viewport.spec.js
-
14src/pixel-unit-regexp.js
-
152src/prop-list-matcher.js
@ -0,0 +1,26 @@ |
|||
# Changelog |
|||
All notable changes to this project will be documented in this file. |
|||
|
|||
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), |
|||
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). |
|||
|
|||
## [1.1.0] - 2019-02-05 |
|||
|
|||
### Added |
|||
- `landscape` (Boolean) Adds `@media (orientation: landscape)` with values converted via `landscapeWidth`. |
|||
- `landscapeUnit` (String) Expected unit for `landscape` option |
|||
- `landscapeWidth` (Number) Viewport width for landscape orientation. |
|||
|
|||
### Fixed |
|||
- `mediaQuery` option if `true` does not mutate its value now, but the rule inside it instead. |
|||
|
|||
## [1.0.0] - 2019-01-28 |
|||
|
|||
### Added |
|||
- `replace` option - (Boolean) replaces rules containing `vw` instead of adding fallbacks. |
|||
- `propList` option - (Array) The properties that can change from `px` to `vw`. |
|||
- `exclude` option - (Array or Regexp) Ignore some files like `node_modules`. |
|||
|
|||
### Changed |
|||
- zero values now remain unitless. |
|||
- replace regexp is now case sensitive, so if you want to change `px`, then `pX` values won't be changed. |
@ -0,0 +1,74 @@ |
|||
## Code of Conduct |
|||
|
|||
### Our Pledge |
|||
|
|||
In the interest of fostering an open and welcoming environment, we as |
|||
contributors and maintainers pledge to making participation in our project and |
|||
our community a harassment-free experience for everyone, regardless of age, body |
|||
size, disability, ethnicity, gender identity and expression, level of experience, |
|||
nationality, personal appearance, race, religion, or sexual identity and |
|||
orientation. |
|||
|
|||
### Our Standards |
|||
|
|||
Examples of behavior that contributes to creating a positive environment |
|||
include: |
|||
|
|||
* Using welcoming and inclusive language |
|||
* Being respectful of differing viewpoints and experiences |
|||
* Gracefully accepting constructive criticism |
|||
* Focusing on what is best for the community |
|||
* Showing empathy towards other community members |
|||
|
|||
Examples of unacceptable behavior by participants include: |
|||
|
|||
* The use of sexualized language or imagery and unwelcome sexual attention or |
|||
advances |
|||
* Trolling, insulting/derogatory comments, and personal or political attacks |
|||
* Public or private harassment |
|||
* Publishing others' private information, such as a physical or electronic |
|||
address, without explicit permission |
|||
* Other conduct which could reasonably be considered inappropriate in a |
|||
professional setting |
|||
|
|||
### Our Responsibilities |
|||
|
|||
Project maintainers are responsible for clarifying the standards of acceptable |
|||
behavior and are expected to take appropriate and fair corrective action in |
|||
response to any instances of unacceptable behavior. |
|||
|
|||
Project maintainers have the right and responsibility to remove, edit, or |
|||
reject comments, commits, code, wiki edits, issues, and other contributions |
|||
that are not aligned to this Code of Conduct, or to ban temporarily or |
|||
permanently any contributor for other behaviors that they deem inappropriate, |
|||
threatening, offensive, or harmful. |
|||
|
|||
### Scope |
|||
|
|||
This Code of Conduct applies both within project spaces and in public spaces |
|||
when an individual is representing the project or its community. Examples of |
|||
representing a project or community include using an official project e-mail |
|||
address, posting via an official social media account, or acting as an appointed |
|||
representative at an online or offline event. Representation of a project may be |
|||
further defined and clarified by project maintainers. |
|||
|
|||
### Enforcement |
|||
|
|||
Instances of abusive, harassing, or otherwise unacceptable behavior may be |
|||
reported by contacting the project team at codeofconduct@evrone.com. All |
|||
complaints will be reviewed and investigated and will result in a response that |
|||
is deemed necessary and appropriate to the circumstances. The project team is |
|||
obligated to maintain confidentiality with regard to the reporter of an incident. |
|||
Further details of specific enforcement policies may be posted separately. |
|||
|
|||
Project maintainers who do not follow or enforce the Code of Conduct in good |
|||
faith may face temporary or permanent repercussions as determined by other |
|||
members of the project's leadership. |
|||
|
|||
### Attribution |
|||
|
|||
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, |
|||
available at [http://contributor-covenant.org/version/1/4][version] |
|||
|
|||
[homepage]: http://contributor-covenant.org |
|||
[version]: http://contributor-covenant.org/version/1/4/ |
@ -0,0 +1,25 @@ |
|||
# Contributing Guidelines |
|||
|
|||
Thanks for taking the time to contribute! |
|||
|
|||
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. |
|||
|
|||
## Reporting issues |
|||
|
|||
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. |
|||
|
|||
Please pay attention to the following points while opening an issue: |
|||
* How to reproduce the issue, step-by-step. |
|||
* The expected behavior (or what is wrong). |
|||
* Screenshots for GUI issues. |
|||
* The application version. |
|||
* The operating system. |
|||
|
|||
## Pull Requests |
|||
|
|||
Pull Requests are always welcome. |
|||
|
|||
1. When you edit the code, please check the formatting of your code before you `git commit`. |
|||
2. Ensure the PR description clearly describes the problem and solution. It should include: |
|||
* The operating system on which you tested. |
|||
* The relevant issue number, if applicable. |
@ -0,0 +1,14 @@ |
|||
// excluding regex trick: http://www.rexegg.com/regex-best-trick.html
|
|||
|
|||
// Not anything inside double quotes
|
|||
// Not anything inside single quotes
|
|||
// Not anything inside url()
|
|||
// Any digit followed by px
|
|||
// !singlequotes|!doublequotes|!url()|pixelunit
|
|||
function getUnitRegexp(unit) { |
|||
return new RegExp('"[^"]+"|\'[^\']+\'|url\\([^\\)]+\\)|(\\d*\\.?\\d+)' + unit, 'g'); |
|||
} |
|||
|
|||
module.exports = { |
|||
getUnitRegexp |
|||
}; |
Write
Preview
Loading…
Cancel
Save
Reference in new issue