Skip to content

Commit

Permalink
Integrated coveralls
Browse files Browse the repository at this point in the history
  • Loading branch information
aisera-mikowski committed Jul 19, 2017
1 parent 5836854 commit 8f4755a
Show file tree
Hide file tree
Showing 7 changed files with 106 additions and 95 deletions.
26 changes: 14 additions & 12 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,14 +1,16 @@
.idea
.git
*.swp
npm-debug.log
.coveralls.yml
.git
.idea
CODE_OF_CONDUCT.html
README*.html
build
coverage
css/vendor
font/vendor
img/vendor
index.html
js/vendor
node_modules
font
cfg
ref
bin/buildify
bin/make_doc
bin/resize_img.sh
bin/superpack-wip.pl
bin/superpack.pl
img/theme_dev.xcf
npm-debug.log

3 changes: 0 additions & 3 deletions AUTHORS.txt

This file was deleted.

46 changes: 46 additions & 0 deletions CODE_OF_CONDUCT.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
# Contributor Covenant 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 mike.mikowski@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems 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/
99 changes: 31 additions & 68 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,30 +1,16 @@
# PowerCSS - JavaScript-powered real-time CSS

[![Coverage Status](https://coveralls.io/repos/github/mmikowski/powercss/badge.svg?branch=master)](https://coveralls.io/github/mmikowski/powercss?branch=master)

## Overview
Unleash JavaScript to create custom styling for every person that uses
your web application. PowerCSS employs merging, caching, compression, and
double-buffering to exceed the flexibility - and often the speed - of
static CSS files. Here is a [presentation][1] of some of the PowerCSS
concepts in practice. The dedicated website is at [powercss.org][2].
Unleash JavaScript to create custom styling for every person that uses your web application. PowerCSS employs merging, caching, compression, and double-buffering to exceed the flexibility - and often the speed - of static CSS files. Here is a [presentation][1] of some of the PowerCSS concepts in practice. The dedicated website is at [powercss.org][2].

## The Goal
A significant problem with traditional CSS files - whether written by an
expert or someone using {less} or Sass - is that they are **not** written
at run-time. With static CSS, application controlled styling that is
responsive to the user's environment is either limited or
simply not possible.

PowerCSS provides the tools to write and apply infinitely adjustable CSS
based on almost any real-time data available to an application: device
orientation, ambient temperature, ambient light, GPS location,
heart rate, or time of day. Traditional static CSS files can't compete with
this flexibility.

We feel that PowerCSS has achieved its primary goal and is often better
than static CSS in many other respects as well. It provides a simple and
familiar API where experienced CSS authors can use their existing skills
to be up and running in minutes. A minified PowerCSS solution can download
faster, render faster after loading, and can speed up some operations by 10x
or more compared to traditional CSS. What's not to like?
A significant problem with traditional CSS files - whether written by an expert or someone using {less} or Sass - is that they are **not** written at run-time. With static CSS, application controlled styling that is responsive to the user's environment is either limited or simply not possible.

PowerCSS provides the tools to write and apply infinitely adjustable CSS based on almost any real-time data available to an application: device orientation, ambient temperature, ambient light, GPS location, heart rate, or time of day. Traditional static CSS files can't compete with this flexibility.

We feel that PowerCSS has achieved its primary goal and is often better than static CSS in many other respects as well. It provides a simple and familiar API where experienced CSS authors can use their existing skills to be up and running in minutes. A minified PowerCSS solution can download faster, render faster after loading, and can speed up some operations by 10x or more compared to traditional CSS. What's not to like?

## Key benefits

Expand Down Expand Up @@ -54,36 +40,22 @@ or more compared to traditional CSS. What's not to like?
- **No dependencies**

## Code Style
PowerCSS is [a library][0] written in the code style presented in the
book **Single Page Web Applications - JavaScript end-to-end**
which is available from [Amazon][3] and directly from [Manning][4].
It uses a **git** hook to block any code that fails to pass JSLint and
regression tests. All object keys have an underscore prefix and suffix
like `_this_` which makes them easy targets for compression.

PowerCSS employs a strict data integrity policy: All regular methods
never change an argument. Only the utility method `_extendRuleMap_`
changes an argument and this is explicit stated in the API docs.
Conversely, PowerCSS does not return pointers to its arrays or objects;
instead one can acquire snapshots using `_getAssetJson_`
and `_getAssetIdList_`.
PowerCSS is [a library][0] written in the code style presented in the book **Single Page Web Applications - JavaScript end-to-end** which is available from [Amazon][3] and directly from [Manning][4]. It uses a **git** hook to block any code that fails to pass JSLint and regression tests. All object keys have an underscore prefix and suffix like `_this_` which makes them easy targets for compression.

PowerCSS employs a strict data integrity policy: All regular methods never change an argument. Only the utility method `_extendRuleMap_` changes an argument and this is explicit stated in the API docs. Conversely, PowerCSS does not return pointers to its arrays or objects; instead one can acquire snapshots using `_getAssetJson_` and `_getAssetIdList_`.

## Example 001: The basics
We were careful to change as little of the existing CSS work-flow as
possible. Here are the steps we will take to create our first example:
We were careful to change as little of the existing CSS work-flow as possible. Here are the steps we will take to create our first example:

1. Create an HTML document
2. Start a JavaScript file
3. Add (virtual) stylesheets
4. Add and use a (virtual) cascade


Let's get started!

### 1. Create an HTML document
Let's create an HTML file named `pcss._ex001_.html` to illustrate
the basic capabilities of PowerCSS. A complete copy of this file can
be found in the `node_modules/powercss/examples` directory or [online][7].
Let's create an HTML file named `pcss._ex001_.html` to illustrate the basic capabilities of PowerCSS. A complete copy of this file can be found in the `node_modules/powercss/examples` directory or [online][7].

```html
<!doctype html>
Expand Down Expand Up @@ -139,18 +111,12 @@ be found in the `node_modules/powercss/examples` directory or [online][7].
</html>
```

Our strategy is to first render the CSS, then the HTML,
and *then* enable analytics. On load, the `body` is not displayed.
This is changed once the PowerCSS stylesheet is written and enabled.
Our strategy is to first render the CSS, then the HTML, and *then* enable analytics. On load, the `body` is not displayed. This is changed once the PowerCSS stylesheet is written and enabled.

### 2. Start a JavaScript file
Let's start a JavaScript file named to `pcss._ex001_.js` to
provide PowerCSS directives. A complete copy can of this file can
be found in the `node_modules/powercss/examples/js` directory or [online][8].
Let's start a JavaScript file named to `pcss._ex001_.js` to provide PowerCSS directives. A complete copy can of this file can be found in the `node_modules/powercss/examples/js` directory or [online][8].

We start our module with identification, JSLint settings, and a reminder
of preferred CSS attribute order. Then we declare our function variables,
and finally we initialize the PowerCSS module.
We start our module with identification, JSLint settings, and a reminder of preferred CSS attribute order. Then we declare our function variables, and finally we initialize the PowerCSS module.

```js
/* pss._ex001_.js
Expand Down Expand Up @@ -191,10 +157,7 @@ pcss._ex001_ = function () {
Yes, Virginia, our code really *does* pass JSLint.
### 3. Add (virtual) stylesheets
Virtual stylesheets (**vsheets**) contain the same information as a
traditional CSS file but in JSON format and using symbols instead of
literal strings. Let's add two **vsheets** definition to `pcss._ex001_.js`.
Don't worry about the syntax yet; we will discuss that in the **Mixin maps**
Virtual stylesheets (**vsheets**) contain the same information as a traditional CSS file but in JSON format and using symbols instead of literal strings. Let's add two **vsheets** definition to `pcss._ex001_.js`. Don't worry about the syntax yet; we will discuss that in the **Mixin maps**
section.
```js
Expand Down Expand Up @@ -311,13 +274,13 @@ section.
Selectors are defined in a list because their order is important
in CSS. PowerCSS records the **vsheet** definition, but it doesn't
compile it to CSS yet - that comes later. Now that we have two
compile it to CSS yet - that comes later. Now that we have two
**vsheets**, let's use them in a virtual **cascade**.
### 4. Add and use a (virtual) cascade
Now we will define a **cascade** which includes an ordered list of **vsheets**.
This is very much like traditional CSS development where we link to static
stylesheet files in an HTML document. A **cascade** merges multiple **vsheets**
stylesheet files in an HTML document. A **cascade** merges multiple **vsheets**
into one. This is similar to how a browser merges multiple CSS files on load.
However, with PowerCSS we can have many **cascades** which are automatically
updated whenever any change affects them.
Expand Down Expand Up @@ -957,7 +920,7 @@ This will result in the following *invalid* CSS:
```

We can optionally include the end condition string to ensure
our closures match. If they do not, a warning is printed to
our closures match. If they do not, a warning is printed to
the console:

```js
Expand Down Expand Up @@ -1399,7 +1362,7 @@ Example | pcss._initModule_({
| _css_val_map_ : {...}
| });
Purpose | Initializes style elements using the provided prefix
Arguments | _style_el_prefix_ (opt) A prefix to name-space the two
Arguments | _style_el_prefix_ (opt) A prefix to name-space the two
| <style> elements. If not provided, the prefix 'pcss'
| will be used.
| _css_key_map_, _css_val_map_ (opt) Maps to used to look-up
Expand Down Expand Up @@ -1577,10 +1540,10 @@ Example | pcss._getGlobalMixinMap_();
Purpose | Returns the currently set global mixin map.
Arguments | none
Notes | This returns a mixinmap pointer, which can lead to problems
| if the application tampers with the content. Don't do that.
| if the application tampers with the content. Don't do that.
Settings | none
Throws | none
Returns | The global mixin map. This could be undef.
Returns | The global mixin map. This could be undef.
```
### `_setStyleAttr_` (new in 1.3)
Expand All @@ -1591,15 +1554,15 @@ Example | pcss._setStyleAttr_({
| _attr_key_ : 'font-size',
| _attr_val_ : '12pt'
| });
Purpose | Immediately changes a selector definition in
Purpose | Immediately changes a selector definition in
| the currently active style sheet. In the example provided,
| all text within the selected class would be resized to 12pt.
| Each attribute change can cause a document reflow.
Arguments | _selector_str_ (req) A CSS selector like '#my_id'
| _attr_key_ (req) A CSS attribute like 'color'
| _attr_val_ (req) A CSS value like '#ff0000'
Notes | Sometimes it is more efficient to change a single style than to
| generate and double-buffer-switch a stylesheet. Profile your
| generate and double-buffer-switch a stylesheet. Profile your
| code if performance is important!
| Future versions will accept a map of attributes to apply to a
| single selector.
Expand All @@ -1609,7 +1572,7 @@ Returns | undef
```
## Regression tests
Regression tests are found under the `test` directory. You may
Regression tests are found under the `test` directory. You may
run using the `npm`, like so:
```bash
Expand Down Expand Up @@ -1671,11 +1634,11 @@ MIT
### Version 1.0.x
- (x) Released 2016-03-25.
### Version 1.1.x
### Version 1.1.x
- (x) Released 2016-03-25.
- (x) Added support for CSS conditional expressions.
- (x) Changed built-in keys to use "bottom" instead of "btm", as this was
needlessly confusing. Example: `_border_btm_` becomes `_border_bottom_`.
needlessly confusing. Example: `_border_btm_` becomes `_border_bottom_`.
- Added method `_getGlobalMixinMap_`.
- Fully backward compatible to 1.0 API.
Expand All @@ -1690,12 +1653,12 @@ MIT
- (x) Release 2016-09-12.
- (x) Expanded keywords support in pcss.cfg.js.
- (x) Removed unfinished bower support.
- (x) Added `setStyleAttr` which provides capability to change styles
- (x) Added `setStyleAttr` which provides capability to change styles
after the stylesheet has been written.
- (x) Fully backward compatible to 1.0 API.
### Version 1.3.x (planned)
- (x) Update `setStyleAttr` to accept a map of attributes and values to
- (x) Update `setStyleAttr` to accept a map of attributes and values to
apply for a selector.
### Version 1.4.x (planned)
Expand Down
7 changes: 5 additions & 2 deletions dist/pcss.js
Original file line number Diff line number Diff line change
Expand Up @@ -1113,10 +1113,13 @@ var pcss = (function () {
// 4.3.2 Set mixin map
switch ( change_type ) {
case '_replace_' :
stateMap._global_mixin_map_ = mixin_map;
stateMap._global_mixin_map_ = cloneData( mixin_map );
break;
case '_merge_' :
extendRuleMap( stateMap._global_mixin_map_ );
extendRuleMap(
stateMap._global_mixin_map_,
cloneData( mixin_map )
);
break;
default: return __0;
}
Expand Down
7 changes: 4 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
C
"author": {
"name": "Michael S. Mikowski",
"email": "mike.mikowski@gmail.com"
Expand All @@ -11,6 +11,7 @@
"deprecated": false,
"description": "Unleash PowerCSS to create custom styling for every user of your web application. PowerCSS uses merging, caching, compression, and double-buffering to exceed the speed and flexibility of static CSS. https://www.youtube.com/watch?v=rnkMjzhxw4s",
"devDependencies": {
"coveralls": "2.13.1",
"istanbul": "0.4.5",
"jsdom": "11.1.0",
"jslint": "0.11.0",
Expand Down Expand Up @@ -47,8 +48,8 @@
"url": "git+https://github.com/mmikowski/powercss.git"
},
"scripts": {
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/nodeunit -- --reporter=verbose test/t.js",
"publish-coverage": "node_modules/.bin/istanbul cover node_modules/.bin/nodeunit -- --reporter=verbose test/t.js | cat coverage/lcov.info | node_modules/.bin/coveralls",
"coverage": "node_modules/.bin/istanbul cover node_modules/.bin/nodeunit test/t.js",
"publish-coverage": "node_modules/.bin/istanbul cover node_modules/.bin/nodeunit test/t.js | cat coverage/lcov.info | node_modules/.bin/coveralls",
"requirements-check": "bin/check-node-version",
"setup": "bin/setup",
"test": "node_modules/.bin/nodeunit test/t.js"
Expand Down
13 changes: 6 additions & 7 deletions test/t.js
Original file line number Diff line number Diff line change
Expand Up @@ -977,9 +977,9 @@ function getData ( test_obj ) {
// =======
expect_str = 'global mixin map is replaced as expected';
ret_data = pcss_obj._setGlobalMixinMap_({
_mixin_map_ : { bing : 'bang' },
_change_type_ : '_replace_',
_regen_type_ : '_all_'
_mixin_map_ : { bing : 'bang' },
_change_type_ : '_replace_',
_regen_type_ : '_all_'
});
ret_data = pcss_obj._getAssetJson_({
_asset_type_ : '_global_mixin_map_'
Expand All @@ -989,15 +989,14 @@ function getData ( test_obj ) {
// =======
expect_str = 'global mixin map is merged as expected';
ret_data = pcss_obj._setGlobalMixinMap_({
_mixin_map_ : { foo : 'bar' },
_mode_type_ : '_merge_',
_regen_type_ : '_all_'
_mixin_map_ : { foo : 'bar' },
_change_type_ : '_merge_',
_regen_type_ : '_all_'
});
ret_data = pcss_obj._getAssetJson_({
_asset_type_ : '_global_mixin_map_'
});
ret_map = JSON.parse( ret_data );
console.warn( '>>>>', ret_data );
test_obj.deepEqual( ret_map, {bing:'bang',foo:'bar'}, expect_str );

// =======
Expand Down

0 comments on commit 8f4755a

Please sign in to comment.