Config.xml

From GreaseSpot

Jump to: navigation, search
The correct title of this article is config.xml. The initial letter is shown capitalized due to technical restrictions.

config.xml is a file in the scripts directory that lists your installed script filenames as well as metadata such as their name, namespace, description, includes, excludes and enabled status.

The contents of the file may look like the following:

<UserScriptConfig>
	<Script filename="examplescript.user.js" name="Example Script" namespace="http://foo.example.com" description="Just an example." enabled="true">
		<Include>http://example.com/*</Include>
		<Include>http://www.example.com/*</Include>
		<Exclude>http://www.example.com/bad/*</Exclude>
	</Script>
	<Script filename="anotherexample.user.js" name="Another Example" namespace="http://bar.example.com" description="A second script." enabled="false">
		<Include>http://example.net/foo/*.php</Include>
		<Exclude>http://example.net/foo/something.php</Exclude>
		<Require filename="bar.js"/>
		<Require filename="baz.js"/>
	</Script>
</UserScriptConfig>

When a script is installed/updated, the metadata is written to config.xml. The metadata block inside the actual script is then effectively ignored – include and exclude rules are read from this file when applying scripts to URLs, and changes in the script manager are written to it. When script includes and excludes are modified in the script manager, config.xml is modified to reflect the changes, but the actual user script files are not modified.

config.xml determines script order. The first <Script>...</Script> entry represents the first script in the script manager and the first script to execute. The second entry is the second script, and so on through the last Script element in the file.

Personal tools