add includePaths

This commit is contained in:
Philipp Kunz 2017-03-12 00:55:34 +01:00
parent 42faa6a389
commit df11f7fe64
6 changed files with 33 additions and 5 deletions

View File

@ -1,5 +1,10 @@
# gitzone standard # gitzone standard
image: hosttoday/ht-docker-node:npmts image: hosttoday/ht-docker-node:npmci
cache:
paths:
- .yarn/
key: "$CI_BUILD_STAGE"
stages: stages:
- test - test
@ -11,6 +16,7 @@ testLEGACY:
stage: test stage: test
script: script:
- npmci test legacy - npmci test legacy
coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
allow_failure: true allow_failure: true
@ -19,6 +25,7 @@ testLTS:
stage: test stage: test
script: script:
- npmci test lts - npmci test lts
coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker
@ -26,6 +33,7 @@ testSTABLE:
stage: test stage: test
script: script:
- npmci test stable - npmci test stable
coverage: /\d+.?\d+?\%\s*coverage/
tags: tags:
- docker - docker

2
dist/index.d.ts vendored
View File

@ -1,8 +1,10 @@
import { Result } from 'node-sass'; import { Result } from 'node-sass';
export interface ISmartsassConstructorOptions { export interface ISmartsassConstructorOptions {
entryFilePath: string; entryFilePath: string;
includePaths?: string[];
} }
export declare class Smartsass { export declare class Smartsass {
includePaths: any[];
entryFilePath: string; entryFilePath: string;
constructor(optionsArg: ISmartsassConstructorOptions); constructor(optionsArg: ISmartsassConstructorOptions);
/** /**

11
dist/index.js vendored
View File

@ -11,7 +11,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
const plugins = require("./smartsass.plugins"); const plugins = require("./smartsass.plugins");
class Smartsass { class Smartsass {
constructor(optionsArg) { constructor(optionsArg) {
this.includePaths = [];
this.entryFilePath = optionsArg.entryFilePath; this.entryFilePath = optionsArg.entryFilePath;
if (optionsArg.includePaths) {
for (let includePath of optionsArg.includePaths) {
this.includePaths.push(includePath);
}
}
} }
/** /**
* renders the Smartsass classes' entryfile and returns result as string * renders the Smartsass classes' entryfile and returns result as string
@ -19,7 +25,8 @@ class Smartsass {
render() { render() {
let done = plugins.smartq.defer(); let done = plugins.smartq.defer();
plugins.sass.render({ plugins.sass.render({
file: this.entryFilePath file: this.entryFilePath,
includePaths: this.includePaths
}, function (err, result) { }, function (err, result) {
if (err) { if (err) {
console.log(err); console.log(err);
@ -40,4 +47,4 @@ class Smartsass {
} }
} }
exports.Smartsass = Smartsass; exports.Smartsass = Smartsass;
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7O0FBQUEsK0NBQThDO0FBUzlDO0lBRUUsWUFBWSxVQUF3QztRQUNsRCxJQUFJLENBQUMsYUFBYSxHQUFHLFVBQVUsQ0FBQyxhQUFhLENBQUE7SUFDL0MsQ0FBQztJQUVEOztPQUVHO0lBQ0gsTUFBTTtRQUNKLElBQUksSUFBSSxHQUFHLE9BQU8sQ0FBQyxNQUFNLENBQUMsS0FBSyxFQUF1QixDQUFBO1FBQ3RELE9BQU8sQ0FBQyxJQUFJLENBQUMsTUFBTSxDQUFDO1lBQ2xCLElBQUksRUFBRSxJQUFJLENBQUMsYUFBYTtTQUN6QixFQUFFLFVBQVUsR0FBRyxFQUFFLE1BQU07WUFDdEIsRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDUixPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO2dCQUNoQixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBQ2xCLENBQUM7WUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO1FBQ3RCLENBQUMsQ0FBQyxDQUFBO1FBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztJQUVEOztP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1lBQ3hCLFlBQVksRUFBRSxJQUFJLENBQUMsWUFBWTtTQUNoQyxFQUFFLFVBQVUsR0FBRyxFQUFFLE1BQU07WUFDdEIsRUFBRSxDQUFDLENBQUMsR0FBRyxDQUFDLENBQUMsQ0FBQztnQkFDUixPQUFPLENBQUMsR0FBRyxDQUFDLEdBQUcsQ0FBQyxDQUFBO2dCQUNoQixJQUFJLENBQUMsTUFBTSxDQUFDLEdBQUcsQ0FBQyxDQUFBO1lBQ2xCLENBQUM7WUFDRCxJQUFJLENBQUMsT0FBTyxDQUFDLE1BQU0sQ0FBQyxDQUFBO1FBQ3RCLENBQUMsQ0FBQyxDQUFBO1FBQ0YsTUFBTSxDQUFDLElBQUksQ0FBQyxPQUFPLENBQUE7SUFDckIsQ0FBQztJQUVEOztPQUVHO0lBQ0csY0FBYyxDQUFFLGNBQXNCOztZQUMxQyxJQUFJLE1BQU0sR0FBRyxNQUFNLElBQUksQ0FBQyxNQUFNLEVBQUUsQ0FBQTtZQUNoQyxNQUFNLE9BQU8sQ0FBQyxTQUFTLENBQUMsTUFBTSxDQUFDLElBQUksQ0FBQyxNQUFNLENBQUMsR0FBRyxDQUFDLFFBQVEsRUFBRSxFQUFFLGNBQWMsQ0FBQyxDQUFBO1FBQzVFLENBQUM7S0FBQTtDQUNGO0FBckNELDhCQXFDQyJ9

0
dist/smartsass.includes.d.ts vendored Normal file
View File

3
dist/smartsass.includes.js vendored Normal file
View File

@ -0,0 +1,3 @@
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoic21hcnRzYXNzLmluY2x1ZGVzLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vdHMvc21hcnRzYXNzLmluY2x1ZGVzLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiIifQ==

View File

@ -4,13 +4,20 @@ import * as plugins from './smartsass.plugins'
import { Result } from 'node-sass' import { Result } from 'node-sass'
export interface ISmartsassConstructorOptions { export interface ISmartsassConstructorOptions {
entryFilePath: string entryFilePath: string,
includePaths?: string[]
} }
export class Smartsass { export class Smartsass {
includePaths = []
entryFilePath: string entryFilePath: string
constructor(optionsArg: ISmartsassConstructorOptions) { constructor(optionsArg: ISmartsassConstructorOptions) {
this.entryFilePath = optionsArg.entryFilePath this.entryFilePath = optionsArg.entryFilePath
if(optionsArg.includePaths) {
for (let includePath of optionsArg.includePaths) {
this.includePaths.push(includePath)
}
}
} }
/** /**
@ -19,7 +26,8 @@ export class Smartsass {
render() { render() {
let done = plugins.smartq.defer<plugins.sass.Result>() let done = plugins.smartq.defer<plugins.sass.Result>()
plugins.sass.render({ plugins.sass.render({
file: this.entryFilePath file: this.entryFilePath,
includePaths: this.includePaths
}, function (err, result) { }, function (err, result) {
if (err) { if (err) {
console.log(err) console.log(err)