This repository was archived by the owner on Jul 23, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 45
This repository was archived by the owner on Jul 23, 2019. It is now read-only.
trying to run Grunt task -- and it just loops over the sitePath rather than iterating over my url list #22
Copy link
Copy link
Open
Description
this is my Gruntfile.js
Everything else seems to be configured correctly. The Grunt task just loops over http://192.168.1.170/trunk and writes the same snapshot over and over again.
module.exports = function(grunt) {
grunt.loadNpmTasks('grunt-html-snapshot');
grunt.initConfig({
htmlSnapshot: {
all: {
options: {
//that's the path where the snapshots should be placed
//it's empty by default which means they will go into the directory
//where your Gruntfile.js is placed
snapshotPath: 'snapshots/',
//This should be either the base path to your index.html file
//or your base URL. Currently the task does not use it's own
//webserver. So if your site needs a webserver to be fully
//functional configure it here.
sitePath: 'http://192.168.1.170/trunk/',
//sitePath: 'http://localhost/amg_gt_c190/trunk/',
//you can choose a prefix for your snapshots
//by default it's 'snapshot_'
fileNamePrefix: 'sp_',
//by default the task waits 500ms before fetching the html.
//this is to give the page enough time to to assemble itself.
//if your page needs more time, tweak here.
msWaitForPages: 1000,
//sanitize function to be used for filenames. Converts '#!/' to '_' as default
//has a filename argument, must have a return that is a sanitized string
/*sanitize: function (requestUri) {
//returns 'index.html' if the url is '/', otherwise a prefix
if (/\//.test(requestUri)) {
return 'index.html';
} else {
return requestUri.replace(/\//g, 'prefix-');
}
},*/
//if you would rather not keep the script tags in the html snapshots
//set `removeScripts` to true. It's false by default
removeScripts: true,
//set `removeLinkTags` to true. It's false by default
removeLinkTags: true,
//set `removeMetaTags` to true. It's false by default
removeMetaTags: true,
//Replace arbitrary parts of the html
replaceStrings:[
{'this': 'will get replaced by this'},
{'/old/path/': '/new/path'}
],
// allow to add a custom attribute to the body
bodyAttr: 'data-prerendered',
//here goes the list of all urls that should be fetched
urls: [
'index_eng.php#media/',
'index_eng.php#media/innovation/',
'index_eng.php#media/innovation/innovation_article01/',
'index_eng.php#media/innovation/innovation_article02/',
'index_eng.php#media/innovation/innovation_article03/',
'index_eng.php#media/innovation/engine-interactive-english/',
'index_eng.php#media/dynamics',
'index_eng.php#media/performance',
'index_eng.php#media/design',
'index_eng.php#buzz/',
'index_deu.php#media/',
'index_deu.php#media/innovation/',
'index_deu.php#media/innovation/innovation_article01/',
'index_deu.php#media/innovation/innovation_article02/',
'index_deu.php#media/innovation/innovation_article03/',
'index_deu.php#media/innovation/engine-interactive-english/',
'index_deu.php#media/dynamics',
'index_deu.php#media/performance',
'index_deu.php#media/design',
'index_deu.php#buzz/'
],
// a list of cookies to be put into the phantomjs cookies jar for the visited page
cookies: [
//following this format should you choose to use it{"path": "/", "domain": "localhost", "name": "lang", "value": "en-gb"}
{}
]
}
}
}
});
};
Metadata
Metadata
Assignees
Labels
No labels