16 Commits

Author SHA1 Message Date
23aa8efef2 2.0.1 2018-09-20 23:06:26 +02:00
d09b5773ca fix(core): update smartsass 2018-09-20 23:06:26 +02:00
b1165827a1 2.0.0 2018-09-20 00:47:15 +02:00
581bae156e BREAKING CHANGE(scope): update scope to @pushrocks 2018-09-20 00:47:15 +02:00
42573648b9 update gitlab yml 2017-03-12 20:08:52 +01:00
b9266d0a9a fix README 2017-03-12 18:59:57 +01:00
3cf679365f improve README 2017-03-12 12:13:29 +01:00
5c13a1d568 improve README 2017-03-12 12:09:08 +01:00
2fb3a039f4 update README 2017-03-12 11:28:12 +01:00
cc91855a48 1.0.5 2017-03-12 10:59:26 +01:00
ef4ee3ee0b add inlude paths later on 2017-03-12 10:59:21 +01:00
975f27d241 update 2017-03-12 00:56:31 +01:00
33cb6ac697 1.0.4 2017-03-12 00:55:47 +01:00
df11f7fe64 add includePaths 2017-03-12 00:55:34 +01:00
42faa6a389 1.0.3 2017-03-05 20:03:25 +01:00
733a67b597 add npmextra.json 2017-03-05 20:03:21 +01:00
15 changed files with 2179 additions and 1374 deletions

View File

@ -1,60 +1,142 @@
# gitzone standard
image: hosttoday/ht-docker-node:npmts
image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .npmci_cache/
key: "$CI_BUILD_STAGE"
stages:
- security
- test
- release
- trigger
- pages
- metadata
# ====================
# security stage
# ====================
mirror:
stage: security
script:
- npmci git mirror
tags:
- docker
- notpriv
snyk:
stage: security
script:
- npmci command npm install -g snyk
- npmci command npm install --ignore-scripts
- npmci command snyk test
tags:
- docker
- notpriv
# ====================
# test stage
# ====================
testLEGACY:
stage: test
script:
- npmci test legacy
- npmci node install legacy
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- docker
- notpriv
allow_failure: true
testLTS:
stage: test
script:
- npmci test lts
- npmci node install lts
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- docker
- notpriv
testSTABLE:
stage: test
script:
- npmci test stable
- npmci node install stable
- npmci npm install
- npmci npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- docker
- docker
- notpriv
release:
stage: release
script:
- npmci publish
- npmci node install stable
- npmci npm publish
only:
- tags
- tags
tags:
- docker
- docker
- notpriv
# ====================
# metadata stage
# ====================
codequality:
stage: metadata
image: docker:stable
allow_failure: true
services:
- docker:stable-dind
script:
- export SP_VERSION=$(echo "$CI_SERVER_VERSION" | sed 's/^\([0-9]*\)\.\([0-9]*\).*/\1-\2-stable/')
- docker run
--env SOURCE_CODE="$PWD"
--volume "$PWD":/code
--volume /var/run/docker.sock:/var/run/docker.sock
"registry.gitlab.com/gitlab-org/security-products/codequality:$SP_VERSION" /code
artifacts:
paths: [codeclimate.json]
tags:
- docker
- priv
trigger:
stage: trigger
stage: metadata
script:
- npmci trigger
- npmci trigger
only:
- tags
- tags
tags:
- docker
- docker
- notpriv
pages:
image: hosttoday/ht-docker-node:npmpage
stage: pages
image: hosttoday/ht-docker-node:npmci
stage: metadata
script:
- npmci command npmpage --publish gitlab
- npmci command npm install -g typedoc typescript
- npmci npm install
- npmci command typedoc --module "commonjs" --target "ES2016" --out public/ ts/
tags:
- docker
- notpriv
only:
- tags
artifacts:
expire_in: 1 week
paths:
- public
allow_failure: true
windowsCompatibility:
image: stefanscherer/node-windows:10-build-tools
stage: metadata
script:
- npm install & npm test
coverage: /\d+.?\d+?\%\s*coverage/
tags:
- windows
allow_failure: true

View File

@ -1,13 +1,16 @@
# smartsass
smart wrapper for sass
## Availabililty
[![npm](https://pushrocks.gitlab.io/assets/repo-button-npm.svg)](https://www.npmjs.com/package/smartsass)
[![git](https://pushrocks.gitlab.io/assets/repo-button-git.svg)](https://GitLab.com/pushrocks/smartsass)
[![git](https://pushrocks.gitlab.io/assets/repo-button-mirror.svg)](https://github.com/pushrocks/smartsass)
[![docs](https://pushrocks.gitlab.io/assets/repo-button-docs.svg)](https://pushrocks.gitlab.io/smartsass/)
## Status for master
[![build status](https://GitLab.com/pushrocks/smartsass/badges/master/build.svg)](https://GitLab.com/pushrocks/smartsass/commits/master)
[![coverage report](https://GitLab.com/pushrocks/smartsass/badges/master/coverage.svg)](https://GitLab.com/pushrocks/smartsass/commits/master)
[![npm downloads per month](https://img.shields.io/npm/dm/smartsass.svg)](https://www.npmjs.com/package/smartsass)
@ -19,11 +22,27 @@ smart wrapper for sass
[![JavaScript Style Guide](https://img.shields.io/badge/code%20style-standard-brightgreen.svg)](http://standardjs.com/)
## Usage
Use TypeScript for best in class instellisense.
```javascript
import * as smartsass from 'smartsass'
import * as bourbon from 'bourbon
import * as neat from 'neat'
let mySmartsass = new smartsass.Smartsass({
filePath: './some.css',
includePaths: bourbon.includePaths
})
mySmartsass.addIncludePaths(neat.includePaths)
let renderedString = mySmartsass.render()
```
For further information read the linked docs at the top of this README.
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

16
dist/index.d.ts vendored
View File

@ -1,16 +0,0 @@
import { Result } from 'node-sass';
export interface ISmartsassConstructorOptions {
entryFilePath: string;
}
export declare class Smartsass {
entryFilePath: string;
constructor(optionsArg: ISmartsassConstructorOptions);
/**
* renders the Smartsass classes' entryfile and returns result as string
*/
render(): Promise<Result>;
/**
* renders and stores
*/
renderAndStore(outputFilePath: string): Promise<void>;
}

43
dist/index.js vendored
View File

@ -1,43 +0,0 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsass.plugins");
class Smartsass {
constructor(optionsArg) {
this.entryFilePath = optionsArg.entryFilePath;
}
/**
* renders the Smartsass classes' entryfile and returns result as string
*/
render() {
let done = plugins.smartq.defer();
plugins.sass.render({
file: this.entryFilePath
}, function (err, result) {
if (err) {
console.log(err);
done.reject(err);
}
done.resolve(result);
});
return done.promise;
}
/**
* renders and stores
*/
renderAndStore(outputFilePath) {
return __awaiter(this, void 0, void 0, function* () {
let result = yield this.render();
yield plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath);
});
}
}
exports.Smartsass = Smartsass;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBUzlDO0lBRUUsWUFBWSxVQUF3QztRQUNsRCxJQUFJLENBQUMsYUFBYSxHQUFHLFVBQVUsQ0FBQyxhQUFhLENBQUE7SUFDL0MsQ0FBQztJQUVEOztPQUVHO0lBQ0gsTUFBTTtRQUNKLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUF1QixDQUFBO1FBQ3RELE9BQU8sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO1lBQ2xCLElBQUksRUFBRSxJQUFJLENBQUMsYUFBYTtTQUN6QixFQUFFLFVBQVUsR0FBRyxFQUFFLE1BQU07WUFDdEIsRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDUixPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO2dCQUNoQixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBQ2xCLENBQUM7WUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO1FBQ3RCLENBQUMsQ0FBQyxDQUFBO1FBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztJQUVEOztPQUVHO0lBQ0csY0FBYyxDQUFFLGNBQXNCOztZQUMxQyxJQUFJLE1BQU0sR0FBRyxNQUFNLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQTtZQUNoQyxNQUFNLE9BQU8sQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxFQUFFLGNBQWMsQ0FBQyxDQUFBO1FBQzVFLENBQUM7S0FBQTtDQUNGO0FBOUJELDhCQThCQyJ9

View File

@ -1,5 +0,0 @@
import 'typings-global';
import * as sass from 'node-sass';
import * as smartfile from 'smartfile';
import * as smartq from 'smartq';
export { sass, smartfile, smartq };

View File

@ -1,10 +0,0 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
require("typings-global");
const sass = require("node-sass");
exports.sass = sass;
const smartfile = require("smartfile");
exports.smartfile = smartfile;
const smartq = require("smartq");
exports.smartq = smartq;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzYXNzLnBsdWdpbnMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9zbWFydHNhc3MucGx1Z2lucy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOztBQUFBLDBCQUF1QjtBQUN2QixrQ0FBaUM7QUFLL0Isb0JBQUk7QUFKTix1Q0FBc0M7QUFLcEMsOEJBQVM7QUFKWCxpQ0FBZ0M7QUFLOUIsd0JBQU0ifQ==

6
npmextra.json Normal file
View File

@ -0,0 +1,6 @@
{
"npmci": {
"npmGlobalTools": [],
"npmAccessLevel": "public"
}
}

1978
package-lock.json generated Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,13 @@
{
"name": "smartsass",
"version": "1.0.2",
"name": "@pushrocks/smartsass",
"version": "2.0.1",
"private": false,
"description": "smart wrapper for sass",
"main": "dist/index.js",
"typings": "dist/index.d.ts",
"scripts": {
"test": "(npmts)"
"test": "(tstest test/)",
"build": "(tsbuild)"
},
"repository": {
"type": "git",
@ -23,10 +25,16 @@
},
"homepage": "https://gitlab.com/pushrocks/smartsass#README",
"dependencies": {
"@pushrocks/smartfile": "^6.0.8",
"@pushrocks/smartpromise": "^2.0.5",
"@types/node-sass": "^3.10.32",
"node-sass": "^4.5.0",
"smartfile": "^4.1.7",
"smartq": "^1.1.1",
"typings-global": "^1.0.14"
"node-sass": "^4.9.3"
},
"devDependencies": {
"@gitzone/tsbuild": "^2.0.22",
"@gitzone/tsrun": "^1.1.12",
"@gitzone/tstest": "^1.0.15",
"@pushrocks/tapbundle": "^3.0.7",
"@types/node": "^10.10.1"
}
}

0
test/test.scss Normal file
View File

12
test/test.ts Normal file
View File

@ -0,0 +1,12 @@
import { tap, expect } from '@pushrocks/tapbundle';
import * as smartsass from '../ts/index';
tap.test('should create a valid instance of smartsass', async () => {
const testsmartSass = new smartsass.Smartsass({
data: 'hello'
})
expect(testsmartSass).to.be.instanceof(smartsass.Smartsass);
});
tap.start();

View File

@ -1,40 +1,64 @@
import * as plugins from './smartsass.plugins'
import * as plugins from './smartsass.plugins';
// interfaces
import { Result } from 'node-sass'
import { Result } from 'node-sass';
export interface ISmartsassConstructorOptions {
entryFilePath: string
data?: string;
entryFilePath?: string;
includePaths?: string[];
}
export class Smartsass {
entryFilePath: string
includePaths = [];
entryFilePath: string;
data: string;
constructor(optionsArg: ISmartsassConstructorOptions) {
this.entryFilePath = optionsArg.entryFilePath
this.entryFilePath = optionsArg.entryFilePath;
this.data = optionsArg.data;
if (optionsArg.includePaths) {
for (let includePath of optionsArg.includePaths) {
this.includePaths.push(includePath);
}
}
}
/**
* add further include paths
*/
addIncludePaths(includePathsArray: string[]) {
for (let includePath of includePathsArray) {
this.includePaths.push(includePath);
}
}
/**
* renders the Smartsass classes' entryfile and returns result as string
*/
render() {
let done = plugins.smartq.defer<plugins.sass.Result>()
plugins.sass.render({
file: this.entryFilePath
}, function (err, result) {
if (err) {
console.log(err)
done.reject(err)
let done = plugins.smartpromise.defer<plugins.sass.Result>();
plugins.sass.render(
{
data: this.data,
file: this.entryFilePath,
includePaths: this.includePaths
},
function(err, result) {
if (err) {
console.log(err);
done.reject(err);
}
done.resolve(result);
}
done.resolve(result)
})
return done.promise
);
return done.promise;
}
/**
* renders and stores
*/
async renderAndStore (outputFilePath: string) {
let result = await this.render()
await plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath)
async renderAndStore(outputFilePath: string) {
let result = await this.render();
await plugins.smartfile.memory.toFs(result.css.toString(), outputFilePath);
}
}

1
ts/smartsass.includes.ts Normal file
View File

@ -0,0 +1 @@
import * as plugins from './smartsass.plugins';

View File

@ -1,10 +1,5 @@
import 'typings-global'
import * as sass from 'node-sass'
import * as smartfile from 'smartfile'
import * as smartq from 'smartq'
import * as sass from 'node-sass';
import * as smartfile from '@pushrocks/smartfile';
import * as smartpromise from '@pushrocks/smartpromise';
export {
sass,
smartfile,
smartq
}
export { sass, smartfile, smartpromise };

1246
yarn.lock

File diff suppressed because it is too large Load Diff