srexi / purecounterjs

A simple yet configurable native javascript counter which you can count on.
MIT License
125 stars 47 forks source link

Add a header to distributed bundles #15

Closed williamdes closed 3 years ago

williamdes commented 3 years ago

Adding a header will allow to source-check distributed files and know what version they are at For example: https://bootstrapmade.com/demo/templates/Squadfree/assets/vendor/purecounter/purecounter.js Demo: https://bootstrapmade.com/demo/templates/Squadfree/

/*!
 *
 *   purecounter.js - A simple yet configurable native javascript counter which you can count on.
 *   Author: Stig Rex
 *   Version: 892c87be3f8367f6bbbfa01bebf59783f7ce3777 (after 1.1.2)
 *   Url: https://github.com/srexi/purecounterjs
 *   License(s): MIT
 *   Source: https://github.com/srexi/purecounterjs/commit/892c87be3f8367f6bbbfa01bebf59783f7ce3777
 *
 */

In my case I did not use a fixed version, but you can easy replace my example

Here is bootstrap's header for an example

 /*!
  * Bootstrap v5.0.0-beta2 (https://getbootstrap.com/)
  * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
  * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
  */
williamdes commented 3 years ago

Hi @srexi Let me know if you want a PR to add this ;)

srexi commented 3 years ago

@williamdes Sounds like a great idea, idk why I never thought about that myself :)

srexi commented 3 years ago

Yeah go ahead a do a PR will accept it ! @williamdes

williamdes commented 3 years ago

Yeah go ahead a do a PR will accept it ! @williamdes

Thanks ;) I kept this one open on my browser. I had tried to implement it but for some reason in production mode the header is removed :/ Will have another try, if it does not affect source maps in a last chance I will just push some content and not use laravel-mix to add the header

williamdes commented 3 years ago

Here it is 🚀 https://github.com/srexi/purecounterjs/pull/18