Skip to content

Latest commit

 

History

History
106 lines (78 loc) · 3.94 KB

contributing.md

File metadata and controls

106 lines (78 loc) · 3.94 KB

Contributing

You're more than welcome to contribute to this project. Please note: your code may be used as part of a commercial product if merged.

Important notes

Please don't edit files in the dist subdirectory as they are generated via npm script. You'll find source code in the src subdirectory!

Code style

Regarding code style like indentation and whitespace, follow the conventions you see used in the source already.

Technology stack

lightGallery built on top of typescript-library-starter by Alex Jover with several modification.

  • TypeScript
  • SCSS
  • Hugo - For documentation website
  • Type Doc - For building documentation
  • Rollup - For bundling
  • Jest - For testing
  • Prettier and eslint for code formatting and consistency

React component

lightGallery react component is created with create-react-app navigate to lightgallery-react folder and follow create react app documentation to start building

Vue.js component

lightGallery Vue.js component is created with Vue CLI navigate to lightgallery-vue folder and follow Vue CLI documentation to start building

Angular component

lightGallery Angular component is created with angular cli navigate to lightgallery-angular folder and follow Angular CLI documentation to start building.

lightgallery angular follows angular workspace folder structure.

inside lightgallery-angular > projects you'll find two folders. angular-demo and lightgallery-angular. lightgallery-angular is for the library and angular-demo is for viewing the preview.

Example of creating new angular build

  • cd lightgallery-angular (navigate to lightgallery-angular folder)

  • npm install @angular/cli@17.0.4

  • ng new 17 --create-application false

  • cd 17

  • ng generate application angular-demo

  • ng generate library lightgallery-angular (Uses folder name as package name)

  • open package.json and add "build:library": "ng build lightgallery-angular"

  • Go to lightGallery dist folder and run npm link

  • Go to lightgallery-angular/17 folder and run npm link lightgallery

  • Change package name to lightgallery/angular/17

  • Need to compile library before using it

  • Replace both lib and app folder from previous version

Docs

Modifying the code

First, ensure that you have the latest Node.js and npm installed.

  1. Fork and clone the repo.
  2. Run npm install to get the project's dependencies
  3. Run npm npm start to start build in watch mode By default only lightGallery core module is compiled and watched If you want to compile any plugins along with the core module, you can run LG_PLUGINS=['thumbnails','pager'] Alternatively, you can run LG_PLUGINS='all' npm start to compile all plugin simultaneously // To tun all plugin - LG_PLUGINS='all' npm start
  4. Navigate to site/ folder and run npm run start to see preview cd site && npm run start

Submitting pull requests

Pull requests are very welcome. Note that if you are going to propose drastic changes, be sure to open an issue for discussion first, to make sure that your PR will be accepted before you spend effort coding it.

  • Create a new branch, please don't work in your master branch directly.
  • Add failing tests for the change you want to make. Run npm run build to see the tests fail.
  • Fix stuff.
  • Run npm run build to see if the tests pass. Repeat steps 2-4 until done.
  • Update the documentation to reflect any changes.
  • Push to your fork and submit a pull request.