Skip to content
This repository has been archived by the owner on Jun 5, 2024. It is now read-only.

Commit

Permalink
Move CSS Folder to src folder
Browse files Browse the repository at this point in the history
  • Loading branch information
Stuyk committed Aug 10, 2022
1 parent ed6a867 commit 96abb67
Show file tree
Hide file tree
Showing 5 changed files with 21 additions and 7 deletions.
10 changes: 5 additions & 5 deletions scripts/plugins/files.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { movePluginFilesToWebview } from './shared.js';

function run() {
movePluginFilesToWebview('icons', ['png'])
movePluginFilesToWebview('webview/css', ['sass', 'css', 'scss', 'stylus'])
movePluginFilesToWebview('webview/images', ['jpg', 'png', 'svg', 'jpeg', 'gif'])
movePluginFilesToWebview('webview/videos', ['webm', 'avi'])
movePluginFilesToWebview('sounds', ['ogg'])
movePluginFilesToWebview('icons', ['png']);
movePluginFilesToWebview('webview/css', ['sass', 'css', 'scss', 'stylus'], true);
movePluginFilesToWebview('webview/images', ['jpg', 'png', 'svg', 'jpeg', 'gif']);
movePluginFilesToWebview('webview/videos', ['webm', 'avi']);
movePluginFilesToWebview('sounds', ['ogg']);
}

run();
10 changes: 8 additions & 2 deletions scripts/plugins/shared.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export function getEnabledPlugins() {
});
}

export function movePluginFilesToWebview(folderName, extensions) {
export function movePluginFilesToWebview(folderName, extensions, isSrc = false) {
const normalizedName = `${folderName}`.replace('webview/', '')

// First Perform Extension & Sub Directory Cleanup
Expand Down Expand Up @@ -58,7 +58,13 @@ export function movePluginFilesToWebview(folderName, extensions) {
for (let i = 0; i < allFiles.length; i++) {
const filePath = allFiles[i];
const regExp = new RegExp(`.*\/${folderName}\/`);
const finalPath = sanitizePath(filePath.replace(regExp, `src-webviews/public/plugins/${normalizedName}/${pluginName}/`))
let finalPath;

if (!isSrc) {
finalPath = sanitizePath(filePath.replace(regExp, `src-webviews/public/plugins/${normalizedName}/${pluginName}/`))
} else {
finalPath = sanitizePath(filePath.replace(regExp, `src-webviews/src/plugins/${normalizedName}/${pluginName}/`))
}

if (fs.existsSync(filePath)) {
const folderPath = sanitizePath(path.dirname(finalPath));
Expand Down
3 changes: 3 additions & 0 deletions src-webviews/src/plugins/css/core-inventory/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.body {
background: red !important;
}
2 changes: 2 additions & 0 deletions src/core/plugins/core-inventory/webview/Inventory2.vue
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ export default defineComponent({
</script>

<style scoped>
@import '@/plugins/css/core-inventory/test.css';
.main-frame {
display: flex;
flex-direction: row;
Expand Down
3 changes: 3 additions & 0 deletions src/core/plugins/core-inventory/webview/css/test.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
.body {
background: red !important;
}

0 comments on commit 96abb67

Please sign in to comment.