Compare commits
20 Commits
Author | SHA1 | Date | |
---|---|---|---|
134618cb3a | |||
9bbbf82b20 | |||
23aa8efef2 | |||
d09b5773ca | |||
b1165827a1 | |||
581bae156e | |||
42573648b9 | |||
b9266d0a9a | |||
3cf679365f | |||
5c13a1d568 | |||
2fb3a039f4 | |||
cc91855a48 | |||
ef4ee3ee0b | |||
975f27d241 | |||
33cb6ac697 | |||
df11f7fe64 | |||
42faa6a389 | |||
733a67b597 | |||
52eef6dd68 | |||
69f8db0ea1 |
1
.gitignore
vendored
1
.gitignore
vendored
@ -2,4 +2,3 @@ coverage/
|
||||
node_modules/
|
||||
public/
|
||||
pages/
|
||||
|
||||
|
120
.gitlab-ci.yml
120
.gitlab-ci.yml
@ -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
|
||||
|
20
README.md
20
README.md
@ -1,13 +1,16 @@
|
||||
# smartsass
|
||||
|
||||
smart wrapper for sass
|
||||
|
||||
## Availabililty
|
||||
|
||||
[](https://www.npmjs.com/package/smartsass)
|
||||
[](https://GitLab.com/pushrocks/smartsass)
|
||||
[](https://github.com/pushrocks/smartsass)
|
||||
[](https://pushrocks.gitlab.io/smartsass/)
|
||||
|
||||
## Status for master
|
||||
|
||||
[](https://GitLab.com/pushrocks/smartsass/commits/master)
|
||||
[](https://GitLab.com/pushrocks/smartsass/commits/master)
|
||||
[](https://www.npmjs.com/package/smartsass)
|
||||
@ -19,10 +22,27 @@ smart wrapper for sass
|
||||
[](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)
|
||||
|
||||
[](https://push.rocks)
|
||||
|
6
npmextra.json
Normal file
6
npmextra.json
Normal file
@ -0,0 +1,6 @@
|
||||
{
|
||||
"npmci": {
|
||||
"npmGlobalTools": [],
|
||||
"npmAccessLevel": "public"
|
||||
}
|
||||
}
|
2115
package-lock.json
generated
Normal file
2115
package-lock.json
generated
Normal file
File diff suppressed because it is too large
Load Diff
25
package.json
25
package.json
@ -1,11 +1,13 @@
|
||||
{
|
||||
"name": "smartsass",
|
||||
"version": "1.0.1",
|
||||
"name": "@pushrocks/smartsass",
|
||||
"version": "2.0.2",
|
||||
"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",
|
||||
@ -21,5 +23,20 @@
|
||||
"bugs": {
|
||||
"url": "https://gitlab.com/pushrocks/smartsass/issues"
|
||||
},
|
||||
"homepage": "https://gitlab.com/pushrocks/smartsass#README"
|
||||
"homepage": "https://gitlab.com/pushrocks/smartsass#README",
|
||||
"dependencies": {
|
||||
"@pushrocks/smartfile": "^6.0.11",
|
||||
"@pushrocks/smartpromise": "^2.0.5",
|
||||
"@types/node-sass": "^3.10.32",
|
||||
"node-sass": "^4.10.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@gitzone/tsbuild": "^2.0.22",
|
||||
"@gitzone/tsrun": "^1.1.13",
|
||||
"@gitzone/tstest": "^1.0.15",
|
||||
"@pushrocks/tapbundle": "^3.0.7",
|
||||
"@types/node": "^10.12.10",
|
||||
"tslint": "^5.11.0",
|
||||
"tslint-config-prettier": "^1.17.0"
|
||||
}
|
||||
}
|
||||
|
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 };
|
Reference in New Issue
Block a user