Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add dist:css step to prod-ify CSS file #2241

Merged
merged 11 commits into from
Mar 15, 2018
Merged
4 changes: 4 additions & 0 deletions .browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Browsers that we support

defaults
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we be more explicit? I don't really want to have to look at the documentation for the default. also more comments in this file would be really helpful, to explain its context

IE 11
2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@
"language-typescript": "github:giladgray/language-typescript#10.1.15",
"lerna": "^2.7.1",
"npm-run-all": "^4.1.2",
"postcss-import": "^11.0.0",
"postcss-url": "^7.3.0",
"sinon": "^4.1.4",
"stylelint": "^8.4.0",
"stylelint-config-palantir": "^2.1.0",
Expand Down
1 change: 1 addition & 0 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:variables": "generate-css-variables common/_colors.scss common/_color-aliases.scss common/_variables.scss",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
Expand Down
8 changes: 6 additions & 2 deletions packages/core/src/blueprint.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2015-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

// Import files in the same order that they are documented in the docs
@import "common/resets";
Expand Down
1 change: 1 addition & 0 deletions packages/datetime/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
"lint:stylelint": "stylelint -s scss \"src/**/*.scss\"",
Expand Down
8 changes: 6 additions & 2 deletions packages/datetime/src/blueprint-datetime.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2015-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

/*
Date & time
Expand Down
8 changes: 6 additions & 2 deletions packages/docs-app/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2015-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "~normalize.css/normalize.css";

Expand Down
1 change: 1 addition & 0 deletions packages/docs-theme/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
"lint:stylelint": "stylelint -s scss \"src/**/*.scss\"",
Expand Down
8 changes: 5 additions & 3 deletions packages/docs-theme/src/docs-theme.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
/**
Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2015-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "styles/api";
Expand Down
1 change: 1 addition & 0 deletions packages/icons/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:variables": "generate-css-variables generated/_icon-variables.scss",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
Expand Down
8 changes: 6 additions & 2 deletions packages/icons/src/blueprint-icons.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2017 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "font-imports";
@import "icons";
1 change: 1 addition & 0 deletions packages/labs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
"lint:stylelint": "stylelint -s scss \"src/**/*.scss\"",
Expand Down
8 changes: 6 additions & 2 deletions packages/labs/src/blueprint-labs.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Copyright 2017 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "./components/index";
8 changes: 6 additions & 2 deletions packages/landing-app/src/index.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2015 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2015-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "~@blueprintjs/core/lib/css/blueprint.css";
@import "~@blueprintjs/core/src/common/variables";
Expand Down
2 changes: 1 addition & 1 deletion packages/node-build-scripts/assert-package-layout
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ const fs = require("fs");
const path = require("path");

// asserts that all main fields in package.json reference existing files
const PACKAGE_MAIN_FIELDS = ["main", "style", "typings", "unpkg"];
const PACKAGE_MAIN_FIELDS = ["main", "module", "style", "types", "typings", "unpkg"];
const manifest = require(path.resolve(process.cwd(), "./package.json"));

for (const field of PACKAGE_MAIN_FIELDS.filter(f => manifest[f] !== undefined)) {
Expand Down
6 changes: 5 additions & 1 deletion packages/node-build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,16 @@
"assert-package-layout": "./assert-package-layout",
"generate-css-variables": "./generate-css-variables",
"generate-icons-source": "./generate-icons-source",
"sass-compile": "./sass-compile"
"sass-compile": "./sass-compile",
"sass-dist": "./sass-dist"
},
"dependencies": {
"autoprefixer": "^7.1.2",
"node-sass": "^4.7.2",
"node-sass-chokidar": "^0.0.3",
"node-sass-package-importer": "^3.0.4",
"postcss-cli": "^5.0.0",
"postcss-discard-comments": "^2.0.4",
"strip-css-comments": "^3.0.0",
"svgo": "^1.0.3"
},
Expand Down
11 changes: 9 additions & 2 deletions packages/node-build-scripts/sass-compile
Original file line number Diff line number Diff line change
@@ -1,15 +1,22 @@
#!/usr/bin/env bash

if [ $# -eq 0 ]; then
echo "Usage: sass-compile <directory> [...args]"
echo "Usage: sass-compile <directory> [<output>] [...args]"
exit 1
fi

# output directory defaults to lib/css
OUTPUT="lib/css/"
if [[ $2 =~ ^[^-] ]]; then
# only assign if it's not a --arg
OUTPUT=$2
fi

# dependencies are hoisted to root node_modules, so load packages from there
ROOT_NM=../../node_modules

$ROOT_NM/.bin/node-sass-chokidar \
--importer $ROOT_NM/node-sass-package-importer/dist/cli.js \
--output lib/css/ \
--output $OUTPUT \
--source-map true \
$@
5 changes: 5 additions & 0 deletions packages/node-build-scripts/sass-dist
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/usr/bin/env bash

# Usage: sass-compile [outdir=lib/css/]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

isn't this more like css-dist? it has nothing to do with sass.


postcss $@ --use autoprefixer --use postcss-discard-comments --replace
1 change: 1 addition & 0 deletions packages/select/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
"lint:stylelint": "stylelint -s scss \"src/**/*.scss\"",
Expand Down
8 changes: 6 additions & 2 deletions packages/select/src/blueprint-select.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Copyright 2017 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "./components/index";
1 change: 1 addition & 0 deletions packages/table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
"lint:stylelint": "stylelint -s scss \"src/**/*.scss\"",
Expand Down
8 changes: 6 additions & 2 deletions packages/table/src/table.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
// Copyright 2016 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2016-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "../../core/src/common/mixins";
@import "./common/loading";
Expand Down
1 change: 1 addition & 0 deletions packages/timezone/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
"dev": "npm-run-all -p \"compile:esm -- --watch\" \"compile:css -- --watch\"",
"dist": "npm-run-all -s \"dist:*\"",
"dist:bundle": "cross-env NODE_ENV=production webpack",
"dist:css": "sass-dist lib/css/*.css",
"dist:verify": "assert-package-layout",
"lint": "npm-run-all -p lint:stylelint lint:tslint",
"lint:stylelint": "stylelint -s scss \"src/**/*.scss\"",
Expand Down
8 changes: 6 additions & 2 deletions packages/timezone/src/blueprint-timezone.scss
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
// Copyright 2017 Palantir Technologies, Inc. All rights reserved.
// Licensed under the terms of the LICENSE file distributed with this project.
/*!

Copyright 2017-present Palantir Technologies, Inc. All rights reserved.
Licensed under the terms of the LICENSE file distributed with this project.

*/

@import "./components/index";
5 changes: 2 additions & 3 deletions packages/webpack-build-scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,14 @@
"test": "exit 0"
},
"dependencies": {
"autoprefixer": "^7.2.4",
"autoprefixer": "^7.1.2",
"awesome-typescript-loader": "^3.4.1",
"circular-dependency-plugin": "^4.3.0",
"css-loader": "^0.28.8",
"extract-text-webpack-plugin": "^3.0.2",
"file-loader": "^1.1.6",
"node-sass": "^4.7.2",
"postcss": "^6.0.16",
"postcss-cli": "^4.1.1",
"postcss-discard-comments": "^2.0.4",
"postcss-loader": "^2.0.10",
"sass-loader": "^6.0.6",
"source-map-loader": "^0.2.3",
Expand Down
18 changes: 0 additions & 18 deletions packages/webpack-build-scripts/postcss.config.js

This file was deleted.

2 changes: 1 addition & 1 deletion packages/webpack-build-scripts/webpack.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ const scssLoaders = [
{
loader: require.resolve("postcss-loader"),
options: {
config: { path: path.resolve(__dirname, "postcss.config.js") },
plugins: [require("autoprefixer"), require("postcss-discard-comments")]
},
},
require.resolve("sass-loader"),
Expand Down
10 changes: 9 additions & 1 deletion tslint.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
{
"extends": "./packages/tslint-config"
"extends": "./packages/tslint-config",
"rules": {
"file-header": {
"options": [
"Copyright \\d{4} Palantir Technologies, Inc\\. All rights reserved.",
"Copyright 2018 Palantir Technologies, Inc. All rights reserved.\n\nLicensed under the terms of the LICENSE file distributed with this project."
]
}
}
}
Loading