ERROR finding /markdown-editor/app/bower_components/polymer/polymer.html
the file is actually in /markdown-editor/bower_components/polymer/polymer.html
what should i do to let it redirect app/bower_components to bower_components?
thanks a lot
Folder structure:
.
โโโ bower_components
โย ย โโโ font-roboto
โย ย โโโ iron-flex-layout
โย ย โโโ paper-styles
โย ย โโโ polymer
โย ย โโโ webcomponentsjs
โโโ src
โโโ tango-palette.html
โโโ vca-theme.html
gulp.task('build', () => {
const redirects = fs.readdirSync('bower_components').filter(file => {
return fs.statSync(path.join('bower_components', file)).isDirectory();
}).map(folder => `${__dirname}/${folder}|${__dirname}/bower_components/${folder}`);
return gulp.src('src/vca-theme.html')
.pipe($.vulcanize({
stripComments: true,
inlineCss: true,
inlineScripts: true,
redirects: [
`${__dirname}/polymer|${__dirname}/bower_components/polymer`,
`${__dirname}/paper-styles|${__dirname}/bower_components/paper-styles/`
]
}))
.pipe(gulp.dest('dist'));
});
@mattyclarkson Can you provide a vanilla (non-gulp) example? I don't see how the const redirects are even used in this code, and I still havent figured out how to use redirects -- the documentation says the first component before | needs to be a URI but you example doesn't indicate this. Too confusing
Here's what I wound up with
var Vulcanize = require('vulcanize');
var crisper = require('crisper');
var fs = require('fs');
var path = require('path');
const target = 'demo/index.html';
const redirects = fs.readdirSync('bower_components').filter(file => {
return fs.statSync(path.join('bower_components', file)).isDirectory();
}).map(folder => `/${folder}/|/bower_components/${folder}/`);
var vulcan = new Vulcanize({
abspath: './',
inlineScripts: true,
inlineCss: true,
stripComments: true,
redirects: redirects,
});
vulcan.process(target, (err, html) => {
if (err) {
// error
} else {
var output = crisper({
source: html,
jsFileName: 'build.js',
});
fs.writeFile('app/build.html', output.html, 'utf-8');
fs.writeFile('app/build.js', output.js, 'utf-8');
}
});
This also works fine:
gulp.task('vulcanize', function(done) {
gulp.src('app/index.html')
.pipe(vulcanize({
abspath: '',
excludes: [],
redirects: [
'/bower_components|./bower_components',
'/elements|./app/elements',
'/styles|./app/styles',
],
stripExcludes: false
}))
.pipe(gulp.dest('dist'));
});
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.