UNPKG

@doku-dev/doku-fragment

Version:

A new Angular UI library that moving away from Bootstrap and built from scratch.

53 lines 2.81 kB
"use strict"; // We don't need this, since we can import SCSS partial file directly in scss file by using, for example // @import "@doku-dev/doku-fragment/breakpoint"; // // Just to make sure to export the file in the package.json `exports` field. // // We keep this file for reference only. var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } 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) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; Object.defineProperty(exports, "__esModule", { value: true }); exports.addStylePreprocessorPath = void 0; const schematics_1 = require("@angular-devkit/schematics"); const utility_1 = require("@schematics/angular/utility"); const messages = require("../../messages"); const util_1 = require("../../util"); const stylePreprocessorPath = 'node_modules/@doku-dev/doku-fragment/assets/styles'; function addStylePreprocessorPath(options) { return (tree) => __awaiter(this, void 0, void 0, function* () { const workspace = yield (0, utility_1.readWorkspace)(tree); const project = yield (0, util_1.getActiveProject)(workspace, options.project); if (!project) { throw new schematics_1.SchematicsException(messages.noProject(messages.noSelectedProject())); } const targetOptions = (0, util_1.getProjectTargetOptions)(project, 'build'); const stylePreprocessorOptions = targetOptions['stylePreprocessorOptions']; if (!stylePreprocessorOptions) { targetOptions['stylePreprocessorOptions'] = { includePaths: [stylePreprocessorPath], }; } else if (!stylePreprocessorOptions['includePaths']) { stylePreprocessorOptions['includePaths'] = [stylePreprocessorPath]; } else { const includePaths = stylePreprocessorOptions['includePaths']; // Check that style path already exists const styleExist = !!includePaths.find((path) => path === stylePreprocessorPath); if (styleExist) return; includePaths.push(stylePreprocessorPath); } yield (0, utility_1.writeWorkspace)(tree, workspace); }); } exports.addStylePreprocessorPath = addStylePreprocessorPath; //# sourceMappingURL=add-style-preprocessor.js.map