Search code examples
javascriptimportrequireuserscriptsrule

How to add @exclude rule to userscript from external file?


The rules for userscript are usualy like this:

// ==UserScript==  
// @name        improvement 
// @author      *** 
// @include     http://*f* 
// @require     *** EXTERNAL FILE *** 
// @description script 
// @grant       none 
// @icon        http://s23.34fa540.png 
// @version     1.0 
// ==/UserScript==

I am trying to import new rule "@exclude" thru the external file that is connected to this user script file. I've tried with rules block in external file, renaming file to .user.js, ... Even breaking the ending tag and adding it to external file. I have no more idea. Does this means that these rules are separated from the script? - They act as some kind of built in commands and stays separate?


Solution

  • As pointed out in documentation @require treats imported resource as thrid-party Javascript code and as no metadata block assumed to be present there, all comments are ignored.