You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
svelte/test/preprocess/samples/use-coffeescript-preprocessor/_config.js

20 lines
382 B

import * as CoffeeScript from 'coffeescript';
export default {
cascade: false,
script: ({content, attributes}) => {
if (attributes.type !== 'text/coffeescript') {
return {code: content};
}
return new Promise((fulfil, reject) => {
try {
const code = CoffeeScript.compile(content, {});
fulfil({code});
} catch (error) {
reject(error);
}
});
},
};