Skip to content

Commit

Permalink
[breaking] Don't import styles by default
Browse files Browse the repository at this point in the history
  • Loading branch information
wojtekmaj committed Dec 15, 2019
1 parent 3343154 commit 0669648
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 43 deletions.
8 changes: 2 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,10 @@ Check the [sample directory](https://github.com/wojtekmaj/react-calendar/tree/ma

### Custom styling

If you don't want to use default React-Calendar styling to build upon it, you can import React-Calendar by using:
If you want to use default React-Calendar styling to build upon it, you can import React-Calendar's styles by using:

```js
// using ES6 modules
import Calendar from 'react-calendar/dist/esm/entry.nostyle';

// using CommonJS modules
import Calendar from 'react-calendar/dist/umd/entry.nostyle';
import 'react-calendar/dist/Calendar.css';
```

instead.
Expand Down
12 changes: 2 additions & 10 deletions copy-styles.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,9 @@
const fs = require('fs');

fs.copyFile('src/Calendar.less', 'dist/esm/Calendar.less', (error) => {
fs.copyFile('src/Calendar.less', 'dist/Calendar.less', (error) => {
if (error) {
throw error;
}
// eslint-disable-next-line no-console
console.log('Calendar.less copied successfully to ESM build.');
});

fs.copyFile('src/Calendar.less', 'dist/umd/Calendar.less', (error) => {
if (error) {
throw error;
}
// eslint-disable-next-line no-console
console.log('Calendar.less copied successfully to UMD build.');
console.log('Calendar.less copied successfully.');
});
13 changes: 5 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,16 @@
"name": "react-calendar",
"version": "3.0.0-beta.4",
"description": "Ultimate calendar for your React app.",
"main": "dist/umd/entry.js",
"module": "dist/esm/entry.js",
"source": "src/entry.js",
"main": "dist/umd/index.js",
"module": "dist/esm/index.js",
"source": "src/index.js",
"sideEffects": false,
"scripts": {
"build": "yarn build-js-all && yarn copy-styles && yarn build-styles",
"build-js-all": "yarn build-js-esm && yarn build-js-umd",
"build-js-esm": "cross-env BABEL_ENV=production-esm babel src -d dist/esm --ignore **/*.spec.js,**/*.spec.jsx",
"build-js-umd": "cross-env BABEL_ENV=production-umd babel src -d dist/umd --ignore **/*.spec.js,**/*.spec.jsx",
"build-styles": "yarn build-styles-esm && yarn build-styles-umd",
"build-styles-esm": "lessc ./dist/esm/Calendar.less ./dist/esm/Calendar.css",
"build-styles-umd": "lessc ./dist/umd/Calendar.less ./dist/umd/Calendar.css",
"build-styles": "lessc ./dist/Calendar.less ./dist/Calendar.css",
"clean": "rimraf dist",
"copy-styles": "node ./copy-styles.js",
"jest": "jest",
Expand All @@ -28,8 +26,7 @@
],
"collectCoverageFrom": [
"**/src/**.{js,jsx}",
"!**/src/entry.js",
"!**/src/entry.nostyle.js"
"!**/src/index.js"
]
},
"keywords": [
Expand Down
19 changes: 0 additions & 19 deletions src/entry.js

This file was deleted.

File renamed without changes.

0 comments on commit 0669648

Please sign in to comment.