Cookie-consent
This is a reusable cookie consent library, with components for displaying cookie policy popups and managing cookie consent.
It uses:
- Vite
- TypeScript
- React
- Modular SCSS
An example of a reusable component that can be created with this template is a Cookie Consent component that can be used in multiple different projects.
Prerequisites
- Node.js
>18
- npm
>9
- Git
Getting Started
To use this template, follow these steps:
-
Navigate to the Cookie-consent on GitLab.
-
Click on the "Fork" button at the top right of the page. Pick a name for the library you're making.
-
Clone the forked repository to your local machine
-
Navigate into the cloned repository:
cd cookie-consent
- Install the dependencies:
npm install
Customizing the Template
To customize the template for your specific library, you need to change the name
in the package.json
file and the build.lib.name
in the vite.config.ts
file.
-
Open the
package.json
file and change thename
field to the name of your library. -
Open the
vite.config.ts
file and change thebuild.lib.name
field to the name of your library.
Publishing a New Version
To publish a new version of your library, you need to be logged into an npm account that is part of the @fully-studios organization. Then, follow these steps:
- Update the version of your library:
npm version [major|minor|patch]
- Build your library:
npm run build
- Publish your library:
npm run publish --access public
Using the library
- Install the library with npm
npm i @fully-studios/cookie-consent
- Import and use a component from the library, along with the styles (optional)
import { Box } from '@fully-studios/cookie-consent';
// Optional style import, not all libraries will necessarily export these
import '@fully-studios/cookie-consent/style.css';
export default function App() {
return (
<Box>
Something
</Box>
);
}
Contributing
Contributions are always welcome! Please feel free to submit a pull request.
License
This project is licensed under the MIT License - see the LICENSE.md file for details.