Skip to content

Template to speed up development of user scripts (Tampermonkey/Greasemonkey/Devtools)

Notifications You must be signed in to change notification settings

master-elodin/user-script-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Tampermonkey/Greasemonkey Template

Quickly create your own Tampermonkey/Greasemonkey/snippet script!

Patch Notes

  • 1.0
    • 1.0.0
      • Template now exists!

How to use

Follow these steps

  • Set script name (defaults to my-project) in the following locations:
    • settings.gradle
    • build.gradle
  • Set author name, description
    • build.gradle
  • Add JavaScript/HTML/CSS/tests to the appropriate places in the src/page folder. NOTE: This template uses the Knockout framework.
  • Run gradle build or gradle clean build to create your single-file devtools or Tampermonkey script!

Creating new components

  1. Add folder to src/ directory
    \ -- src
        \ -- new-item
            \ -- new-item.js
              -- new-item.spec.js
              -- new-item.html
              -- new-item.css
    
  2. Add component to spec/SpecRunner.html to get tests to run
    <script src="../src/new-item/new-item.js"></script>
    <script src="../src/new-item/new-item.spec.js"></script>
    
  3. Add JavaScript placeholder to shell.js
    ${src/new-item/new-item.js}
    
  4. Add HTML to wherever it's needed (e.g. inside page.html)
    ${src/new-item/new-item.html}
    
  5. Add logic to new-item.js file and tests for that logic in new-item.spec.js

Notes

  • In build.gradle, cssProperties contains (obviously) CSS properties. Use like this: background-color: $midnight. The build will resolve the placeholder so it will end up with background-color: #2c3e50.
  • CSS will be picked up without explictly adding it anywhere

About

Template to speed up development of user scripts (Tampermonkey/Greasemonkey/Devtools)

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages