mirror of
https://github.com/marko-js/marko.git
synced 2025-12-08 19:26:05 +00:00
Moved out the optimizer plugin to a top-level module
This commit is contained in:
parent
ca2dffc968
commit
c1366a3f03
@ -1,40 +0,0 @@
|
||||
var raptorTemplatesCompiler = require('../../compiler');
|
||||
var nodePath = require('path');
|
||||
|
||||
function reader(path, context, callback) {
|
||||
raptorTemplatesCompiler.compileFile(path, callback);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
properties: {
|
||||
'path': 'string'
|
||||
},
|
||||
|
||||
init: function() {
|
||||
if (!this.path) {
|
||||
throw new Error('"path" is required for a Raptor Templates dependency');
|
||||
}
|
||||
|
||||
this.path = this.resolvePath(this.path);
|
||||
},
|
||||
|
||||
getDependencies: function() {
|
||||
/*
|
||||
You may be wondering why we return a set of dependencies instead of
|
||||
just providing a "read" method. By piggy backing off the "require"
|
||||
dependency type we can automatically have our compiled CommonJS module
|
||||
inspected for additional dependencies.
|
||||
*/
|
||||
return [
|
||||
{
|
||||
type: 'require',
|
||||
resolvedPath: this.path,
|
||||
reader: reader
|
||||
}
|
||||
];
|
||||
},
|
||||
|
||||
getDir: function() {
|
||||
return nodePath.dirname(this.path);
|
||||
}
|
||||
};
|
||||
@ -1,3 +0,0 @@
|
||||
module.exports = function(optimizer, config) {
|
||||
optimizer.dependencies.registerPackageType('rhtml', require('./dependency-rhtml'));
|
||||
};
|
||||
@ -1,3 +0,0 @@
|
||||
{
|
||||
"main": "./lib/raptor-optimizer-plugin.js"
|
||||
}
|
||||
Loading…
x
Reference in New Issue
Block a user