开发者

Which tool for bundling ts and sass in a plain old php website [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.

Closed 12 hours ago.

Improve this question

So, I have to maintain this old big php project that doesn't use any framework or template engines or anything. Just plain, simple, vanilla, how web dev was back in the day.

A very dumbed down overview:

Index.php

<?php
define('VERSION', '1.1');
?>
<html>
<head>
<script src="dist/scripts.js?v=<?=VERSION?>"></script>
<link rel="stylesheet" type="text/css" href="dist/styles.css?v=<?=VERSION?>" />
</head>
<body>
<?php
// dynamically includes various pages
?>
</body>
</html>

Files:

index.php

dist
-scripts.js
-styles.css

js (using ES modules)
-scripts.ts (imports a.ts and b.ts)
-a.ts
-b.ts

css (using sass)
-styles.scss (imports pagea.scss and pageb.scss)
-pagea.scss
-pageb.scss

What simply needs to happen is:

  1. the .ts files need to transpiled and bundled into dist/scripts.js
  2. the .scss needs to be transpiled and bundled into dist/styles.css
  3. some live browser refresh when a change is made in the code during development

This project used to have GulpJS to achieve this, and used this with BrowserSync for hot reloading changes. However, gulp in 2022 doesn't seem to be 'the tool' anymore and has been broken recently after the adding of some ES modules. (because it still expects commonJS stuff. So, I am exploring to find a (better) alternative.

After days of searching for newer/better bundling tools I feel like I don't know anything about webdev anymore. All the tools and plugins that are being thrown at you, all claiming to be easier, faster, better...

'Hot' tools tha开发者_JAVA技巧t came across are: vite, parcel, rollup, snowpack. However, the one big thing they have in common is they all seem to have a very react-ish SPA centered view. All expecting an index.html as the single entrypoint for an 'webapp' from where they can magically resolve all the dependencies.

Well, I don't have that. Everything these tools have to offer seems overkill, overly complicated or just not a right fit for this project. I'm just having a plain old index.php that is serving dozens of pages as an 'classic website' (not an SPA or anything). And the globally used <head> simply uses a <script> and <link> tag for global styling and some interactivity.

So, I am very eager to know:

  1. Am I really the only person on this planet facing this problem?
  2. What would be the solution to achieve this desired transpiling+bundling?

Thank you very much for any responses :-)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜