@nrk/core-css
Advanced tools
Comparing version 1.10.0 to 1.10.1
@@ -1,7 +0,11 @@ | ||
const fs = require('fs'); | ||
const path = require('path'); | ||
const {version} = require('../package.json'); | ||
const lib = path.join(__dirname, '../lib'); | ||
const fs = require('fs') | ||
const path = require('path') | ||
const { version } = require('../package.json') | ||
const lib = path.join(__dirname, '../lib') | ||
const autoprefixer = require('autoprefixer') | ||
const postcss = require('postcss') | ||
const minifyCss = (css) => String(css) // Work with file as string | ||
const prefixer = autoprefixer({ browsers: ['last 1 version', '> .1%', 'ie 9-11'] }) | ||
const minifyCss = css => String(css) // Work with file as string | ||
.replace(/\/\*[^!][^*]*\*\//g, '') // Strip comments | ||
@@ -12,9 +16,10 @@ .replace(/\s*(^|[>:;,{}/]|$)\s*/g, '$1') // Strip white space around tokens | ||
.resolve(fs.readFileSync(path.join(lib, 'core-css.css'))) | ||
.then((css) => `/*! Core CSS v${version} - Copyright (c) 2015-${new Date().getFullYear()} NRK <opensource@nrk.no> */\n${css}`) | ||
.then((css) => fs.writeFileSync(path.join(lib, 'core-css.min.css'), minifyCss(css))) | ||
.then(css => `/*! Core CSS v${version} - Copyright (c) 2015-${new Date().getFullYear()} NRK <opensource@nrk.no> */\n${css}`) | ||
.then(css => postcss([prefixer]).process(css, { from: 'lib/core-css.css', to: 'lib/core-css.min.css' })) | ||
.then(css => fs.writeFileSync(path.join(lib, 'core-css.min.css'), minifyCss(css))) | ||
const buildDocs = () => Promise | ||
.resolve(fs.readFileSync(path.join(lib, 'docs.md'))) | ||
.then((md) => String(md).replace(/\/major\/\d+/, `/major/${version.match(/\d+/)}`)) | ||
.then((md) => fs.writeFileSync(path.join(lib, 'docs.md'), md)) | ||
.then(md => String(md).replace(/\/major\/\d+/, `/major/${version.match(/\d+/)}`)) | ||
.then(md => fs.writeFileSync(path.join(lib, 'docs.md'), md)) | ||
@@ -24,2 +29,2 @@ buildCss() | ||
.then(() => console.log('Built CSS and docs')) | ||
.catch((err) => console.log(err.stack)) | ||
.catch(err => console.log(err.stack)) |
@@ -6,3 +6,3 @@ { | ||
"author": "NRK <opensource@nrk.no> (https://www.nrk.no/)", | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"license": "MIT", | ||
@@ -23,4 +23,6 @@ "scripts": { | ||
"devDependencies": { | ||
"http-server": "0.11.1" | ||
"autoprefixer": "9.4.0", | ||
"http-server": "0.11.1", | ||
"postcss": "7.0.6" | ||
} | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
New author
Supply chain riskA new npm collaborator published a version of the package for the first time. New collaborators are usually benign additions to a project, but do indicate a change to the security surface area of a package.
Found 1 instance in 1 package
52975
0
3
346