Compare commits
26 Commits
Author | SHA1 | Date | |
---|---|---|---|
7a4372f104 | |||
caa194dee6 | |||
5913245604 | |||
ad753b3a9a | |||
9fc47fcca1 | |||
cfcff789a2 | |||
134618cb3a | |||
9bbbf82b20 | |||
23aa8efef2 | |||
d09b5773ca | |||
b1165827a1 | |||
581bae156e | |||
42573648b9 | |||
b9266d0a9a | |||
3cf679365f | |||
5c13a1d568 | |||
2fb3a039f4 | |||
cc91855a48 | |||
ef4ee3ee0b | |||
975f27d241 | |||
33cb6ac697 | |||
df11f7fe64 | |||
42faa6a389 | |||
733a67b597 | |||
52eef6dd68 | |||
69f8db0ea1 |
19
.gitignore
vendored
19
.gitignore
vendored
@ -1,5 +1,22 @@
|
|||||||
|
.nogit/
|
||||||
|
|
||||||
|
# artifacts
|
||||||
coverage/
|
coverage/
|
||||||
node_modules/
|
|
||||||
public/
|
public/
|
||||||
pages/
|
pages/
|
||||||
|
|
||||||
|
# installs
|
||||||
|
node_modules/
|
||||||
|
|
||||||
|
# caches
|
||||||
|
.yarn/
|
||||||
|
.cache/
|
||||||
|
.rpt2_cache
|
||||||
|
|
||||||
|
# builds
|
||||||
|
dist/
|
||||||
|
dist_web/
|
||||||
|
dist_serve/
|
||||||
|
dist_ts_web/
|
||||||
|
|
||||||
|
# custom
|
@ -1,60 +1,118 @@
|
|||||||
# gitzone standard
|
# gitzone ci_default
|
||||||
image: hosttoday/ht-docker-node:npmts
|
image: registry.gitlab.com/hosttoday/ht-docker-node:npmci
|
||||||
|
|
||||||
|
cache:
|
||||||
|
paths:
|
||||||
|
- .npmci_cache/
|
||||||
|
key: "$CI_BUILD_STAGE"
|
||||||
|
|
||||||
stages:
|
stages:
|
||||||
|
- security
|
||||||
- test
|
- test
|
||||||
- release
|
- release
|
||||||
- trigger
|
- metadata
|
||||||
- pages
|
|
||||||
|
|
||||||
testLEGACY:
|
# ====================
|
||||||
stage: test
|
# security stage
|
||||||
|
# ====================
|
||||||
|
mirror:
|
||||||
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci test legacy
|
- npmci git mirror
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
allow_failure: true
|
- notpriv
|
||||||
|
|
||||||
testLTS:
|
snyk:
|
||||||
stage: test
|
stage: security
|
||||||
script:
|
script:
|
||||||
- npmci test lts
|
- npmci npm prepare
|
||||||
|
- npmci command npm install -g snyk
|
||||||
|
- npmci command npm install --ignore-scripts
|
||||||
|
- npmci command snyk test
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
testSTABLE:
|
# ====================
|
||||||
|
# test stage
|
||||||
|
# ====================
|
||||||
|
|
||||||
|
testStable:
|
||||||
stage: test
|
stage: test
|
||||||
script:
|
script:
|
||||||
- npmci test stable
|
- npmci npm prepare
|
||||||
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci npm test
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
|
testBuild:
|
||||||
|
stage: test
|
||||||
|
script:
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci node install stable
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command npm run build
|
||||||
|
coverage: /\d+.?\d+?\%\s*coverage/
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
release:
|
release:
|
||||||
stage: release
|
stage: release
|
||||||
script:
|
script:
|
||||||
- npmci publish
|
- npmci node install stable
|
||||||
|
- npmci npm publish
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
|
# ====================
|
||||||
|
# metadata stage
|
||||||
|
# ====================
|
||||||
|
codequality:
|
||||||
|
stage: metadata
|
||||||
|
allow_failure: true
|
||||||
|
script:
|
||||||
|
- npmci command npm install -g tslint typescript
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command "tslint -c tslint.json ./ts/**/*.ts"
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- priv
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
stage: trigger
|
stage: metadata
|
||||||
script:
|
script:
|
||||||
- npmci trigger
|
- npmci trigger
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
tags:
|
tags:
|
||||||
- docker
|
- docker
|
||||||
|
- notpriv
|
||||||
|
|
||||||
pages:
|
pages:
|
||||||
image: hosttoday/ht-docker-node:npmpage
|
stage: metadata
|
||||||
stage: pages
|
|
||||||
script:
|
script:
|
||||||
- npmci command npmpage --publish gitlab
|
- npmci node install lts
|
||||||
|
- npmci command npm install -g @gitzone/tsdoc
|
||||||
|
- npmci npm prepare
|
||||||
|
- npmci npm install
|
||||||
|
- npmci command tsdoc
|
||||||
|
tags:
|
||||||
|
- docker
|
||||||
|
- notpriv
|
||||||
only:
|
only:
|
||||||
- tags
|
- tags
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
|
allow_failure: true
|
||||||
|
52
README.md
52
README.md
@ -1,28 +1,50 @@
|
|||||||
# smartsass
|
# @pushrocks/smartsass
|
||||||
smart wrapper for sass
|
smart wrapper for sass
|
||||||
|
|
||||||
## Availabililty
|
## Availabililty and Links
|
||||||
[](https://www.npmjs.com/package/smartsass)
|
* [npmjs.org (npm package)](https://www.npmjs.com/package/@pushrocks/smartsass)
|
||||||
[](https://GitLab.com/pushrocks/smartsass)
|
* [gitlab.com (source)](https://gitlab.com/pushrocks/smartsass)
|
||||||
[](https://github.com/pushrocks/smartsass)
|
* [github.com (source mirror)](https://github.com/pushrocks/smartsass)
|
||||||
[](https://pushrocks.gitlab.io/smartsass/)
|
* [docs (typedoc)](https://pushrocks.gitlab.io/smartsass/)
|
||||||
|
|
||||||
## Status for master
|
## Status for master
|
||||||
[](https://GitLab.com/pushrocks/smartsass/commits/master)
|
[](https://gitlab.com/pushrocks/smartsass/commits/master)
|
||||||
[](https://GitLab.com/pushrocks/smartsass/commits/master)
|
[](https://gitlab.com/pushrocks/smartsass/commits/master)
|
||||||
[](https://www.npmjs.com/package/smartsass)
|
[](https://www.npmjs.com/package/@pushrocks/smartsass)
|
||||||
[](https://david-dm.org/pushrocks/smartsass)
|
[](https://snyk.io/test/npm/@pushrocks/smartsass)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartsass/master/dependencies/npm)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://www.bithound.io/github/pushrocks/smartsass)
|
[](https://nodejs.org/dist/latest-v10.x/docs/api/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
[](https://prettier.io/)
|
||||||
[](https://nodejs.org/dist/latest-v6.x/docs/api/)
|
|
||||||
[](http://standardjs.com/)
|
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
Use TypeScript for best in class instellisense.
|
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.
|
For further information read the linked docs at the top of this README.
|
||||||
|
|
||||||
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
> MIT licensed | **©** [Lossless GmbH](https://lossless.gmbh)
|
||||||
|
> | By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy.html)
|
||||||
|
|
||||||
[](https://push.rocks)
|
[](https://push.rocks)
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
||||||
|
[](https://maintainedby.lossless.com)
|
||||||
|
16
npmextra.json
Normal file
16
npmextra.json
Normal file
@ -0,0 +1,16 @@
|
|||||||
|
{
|
||||||
|
"npmci": {
|
||||||
|
"npmGlobalTools": [],
|
||||||
|
"npmAccessLevel": "public"
|
||||||
|
},
|
||||||
|
"gitzone": {
|
||||||
|
"module": {
|
||||||
|
"githost": "gitlab.com",
|
||||||
|
"gitscope": "pushrocks",
|
||||||
|
"gitrepo": "smartsass",
|
||||||
|
"shortDescription": "smart wrapper for sass",
|
||||||
|
"npmPackagename": "@pushrocks/smartsass",
|
||||||
|
"license": "MIT"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
2697
package-lock.json
generated
Normal file
2697
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
36
package.json
36
package.json
@ -1,11 +1,13 @@
|
|||||||
{
|
{
|
||||||
"name": "smartsass",
|
"name": "@pushrocks/smartsass",
|
||||||
"version": "1.0.1",
|
"version": "2.0.5",
|
||||||
|
"private": false,
|
||||||
"description": "smart wrapper for sass",
|
"description": "smart wrapper for sass",
|
||||||
"main": "dist/index.js",
|
"main": "dist/index.js",
|
||||||
"typings": "dist/index.d.ts",
|
"typings": "dist/index.d.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"test": "(npmts)"
|
"test": "(tstest test/)",
|
||||||
|
"build": "(tsbuild)"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@ -21,5 +23,31 @@
|
|||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://gitlab.com/pushrocks/smartsass/issues"
|
"url": "https://gitlab.com/pushrocks/smartsass/issues"
|
||||||
},
|
},
|
||||||
"homepage": "https://gitlab.com/pushrocks/smartsass#README"
|
"homepage": "https://gitlab.com/pushrocks/smartsass#README",
|
||||||
|
"dependencies": {
|
||||||
|
"@pushrocks/smartfile": "^7.0.6",
|
||||||
|
"@pushrocks/smartpromise": "^3.0.6",
|
||||||
|
"@types/node-sass": "^4.11.0",
|
||||||
|
"node-sass": "^4.13.0"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@gitzone/tsbuild": "^2.1.17",
|
||||||
|
"@gitzone/tsrun": "^1.2.8",
|
||||||
|
"@gitzone/tstest": "^1.0.28",
|
||||||
|
"@pushrocks/tapbundle": "^3.2.0",
|
||||||
|
"@types/node": "^13.1.6",
|
||||||
|
"tslint": "^5.20.1",
|
||||||
|
"tslint-config-prettier": "^1.18.0"
|
||||||
|
},
|
||||||
|
"files": [
|
||||||
|
"ts/**/*",
|
||||||
|
"ts_web/**/*",
|
||||||
|
"dist/**/*",
|
||||||
|
"dist_web/**/*",
|
||||||
|
"dist_ts_web/**/*",
|
||||||
|
"assets/**/*",
|
||||||
|
"cli.js",
|
||||||
|
"npmextra.json",
|
||||||
|
"readme.md"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
|
0
test/test.scss
Normal file
0
test/test.scss
Normal file
12
test/test.ts
Normal file
12
test/test.ts
Normal 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();
|
64
ts/index.ts
Normal file
64
ts/index.ts
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
import * as plugins from './smartsass.plugins';
|
||||||
|
|
||||||
|
// interfaces
|
||||||
|
import { Result } from 'node-sass';
|
||||||
|
|
||||||
|
export interface ISmartsassConstructorOptions {
|
||||||
|
data?: string;
|
||||||
|
entryFilePath?: string;
|
||||||
|
includePaths?: string[];
|
||||||
|
}
|
||||||
|
|
||||||
|
export class Smartsass {
|
||||||
|
includePaths = [];
|
||||||
|
entryFilePath: string;
|
||||||
|
data: string;
|
||||||
|
constructor(optionsArg: ISmartsassConstructorOptions) {
|
||||||
|
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.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);
|
||||||
|
}
|
||||||
|
);
|
||||||
|
return done.promise;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* renders and stores
|
||||||
|
*/
|
||||||
|
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
1
ts/smartsass.includes.ts
Normal file
@ -0,0 +1 @@
|
|||||||
|
import * as plugins from './smartsass.plugins';
|
5
ts/smartsass.plugins.ts
Normal file
5
ts/smartsass.plugins.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import * as sass from 'node-sass';
|
||||||
|
import * as smartfile from '@pushrocks/smartfile';
|
||||||
|
import * as smartpromise from '@pushrocks/smartpromise';
|
||||||
|
|
||||||
|
export { sass, smartfile, smartpromise };
|
16
tslint.json
16
tslint.json
@ -1,3 +1,17 @@
|
|||||||
{
|
{
|
||||||
"extends": "tslint-config-standard"
|
"extends": ["tslint:latest", "tslint-config-prettier"],
|
||||||
|
"rules": {
|
||||||
|
"semicolon": [true, "always"],
|
||||||
|
"no-console": false,
|
||||||
|
"ordered-imports": false,
|
||||||
|
"object-literal-sort-keys": false,
|
||||||
|
"member-ordering": {
|
||||||
|
"options":{
|
||||||
|
"order": [
|
||||||
|
"static-method"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"defaultSeverity": "warning"
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user