javascript - Grunt add @import path to js file
问题描述
my use case is the follwoing one: I need a general 'importer js' that only imports all files out of an dist. Ive tried it with several grunt task but found nothing that automatically build includes (only the import statement -> not the content) of paths of a dist to a js file. My last attempt was with
grunt-include-source
But as i assume it only can handle the import of js files to an html -> the follwoing attempt to change it from js to js was not succeed:
includeSource: {
options: {
basePath: 'dist',
baseUrl: 'dist/js',
templates: {
js: {
js: '<script src="{filePath}"></script>',
}
}
},
myTarget: {
files: {
'dist/test.js': 'dist/templ.tpl.js'
}
}
}
Does anyone have any other ideas - every suggestion is welcome! (Ive also tried with grunt-usemin or grunt-rev)
解决方案
推荐阅读
- php - 使用 php Curl 登录网站并解析受限网页
- java - 如何提供 Mono 消费者作为方法参数?
- javascript - 现在知道数组的数量
- windows - Qemu STM32 仿真
- javascript - 单选按钮使用 jQuery 更改类
- javascript - 如何为不同的域 API 设置 Vue CORS?
- node.js - 使用带有rest api的node js在另一个表中添加用户名和密码
- javascript - 事件传播相关:父(焦点)和子(点击)的不同事件都是触发器
- linux - 如何恢复 xxd -r -p text_dump > binary_dump 的操作?
- python - 将秘密图像的每个像素的每一点都嵌入到封面图像中