2 Commits

Author SHA1 Message Date
52eef6dd68 1.0.2 2017-03-05 18:29:53 +01:00
69f8db0ea1 first ready to use implementation 2017-03-05 18:29:46 +01:00
10 changed files with 1380 additions and 3 deletions

1
.gitignore vendored
View File

@ -2,4 +2,3 @@ coverage/
node_modules/ node_modules/
public/ public/
pages/ pages/

View File

@ -24,5 +24,6 @@ Use TypeScript for best in class instellisense.
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)
[![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks) [![repo-footer](https://pushrocks.gitlab.io/assets/repo-footer.svg)](https://push.rocks)

16
dist/index.d.ts vendored Normal file
View File

@ -0,0 +1,16 @@
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 Normal file
View File

@ -0,0 +1,43 @@
"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

5
dist/smartsass.plugins.d.ts vendored Normal file
View File

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

10
dist/smartsass.plugins.js vendored Normal file
View File

@ -0,0 +1,10 @@
"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==

View File

@ -1,6 +1,6 @@
{ {
"name": "smartsass", "name": "smartsass",
"version": "1.0.1", "version": "1.0.2",
"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",
@ -21,5 +21,12 @@
"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": {
"@types/node-sass": "^3.10.32",
"node-sass": "^4.5.0",
"smartfile": "^4.1.7",
"smartq": "^1.1.1",
"typings-global": "^1.0.14"
}
} }

40
ts/index.ts Normal file
View File

@ -0,0 +1,40 @@
import * as plugins from './smartsass.plugins'
// interfaces
import { Result } from 'node-sass'
export interface ISmartsassConstructorOptions {
entryFilePath: string
}
export class Smartsass {
entryFilePath: string
constructor(optionsArg: ISmartsassConstructorOptions) {
this.entryFilePath = optionsArg.entryFilePath
}
/**
* 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)
}
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)
}
}

10
ts/smartsass.plugins.ts Normal file
View File

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

1246
yarn.lock Normal file

File diff suppressed because it is too large Load Diff