poops 1.0.20 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +182 -106
- package/lib/copy.js +8 -10
- package/lib/markups.js +34 -21
- package/lib/scripts.js +9 -11
- package/lib/ssg.js +158 -0
- package/lib/styles.js +10 -107
- package/lib/utils/helpers.js +45 -129
- package/lib/utils/print-style.js +1 -1
- package/package.json +18 -10
- package/poops.js +102 -87
package/README.md
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
# 💩 Poops [](https://www.npmjs.com/package/poops)
|
|
2
|
+
|
|
2
3
|
Straightforward, no-bullshit bundler for the web.
|
|
3
4
|
|
|
4
5
|
> When your day is long
|
|
@@ -17,7 +18,7 @@ Straightforward, no-bullshit bundler for the web.
|
|
|
17
18
|
|
|
18
19
|
[R.E.M. - Everybody Poops :poop:](https://www.youtube.com/watch?v=5rOiW_xY-kc)
|
|
19
20
|
|
|
20
|
-
|
|
21
|
+
---
|
|
21
22
|
|
|
22
23
|
Intuitive with a minimal learning curve and minimal docs, utilizing the most efficient transpilers and compilers available (like [dart-sass](https://sass-lang.com/dart-sass) and [esbuild](https://esbuild.github.io/)) Poops aims to be the simplest bundler option there is. If it's not, please do contribute so we can make it so! 🙏 All ideas and contributions are welcome.
|
|
23
24
|
|
|
@@ -25,20 +26,20 @@ It uses a simple config file where you define your input and output paths and it
|
|
|
25
26
|
|
|
26
27
|
## Features
|
|
27
28
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
29
|
+
- Bundles SCSS/SASS to CSS
|
|
30
|
+
- Uses [dart-sass](https://sass-lang.com/dart-sass) for SCSS/SASS bundling
|
|
31
|
+
- Bundles JS/TS/JSX/TSX to IIFE/ESM/CJS
|
|
32
|
+
- Uses [esbuild](https://esbuild.github.io/) for bundling and transpiling JS/TS/JSX/TSX to IIFE/ESM/CJS
|
|
33
|
+
- Optional JS and CSS minification using [esbuild](https://esbuild.github.io/)
|
|
34
|
+
- Can produce minified code simultaneously with non-minified code! (cause I always forget to minify my code for production)
|
|
35
|
+
- Supports source maps only for non minified - non production code (optional)
|
|
36
|
+
- Supports multiple input and output paths
|
|
37
|
+
- Resolves node modules
|
|
38
|
+
- Can add a templatable banner to output files (optional)
|
|
39
|
+
- Static site generation with [nunjucks](https://mozilla.github.io/nunjucks/) templating, with blogging option (optional)
|
|
40
|
+
- Has a configurable local server (optional)
|
|
41
|
+
- Rebuilds on file changes (optional)
|
|
42
|
+
- Live reloads on file changes (optional)
|
|
42
43
|
|
|
43
44
|
## Quick Start
|
|
44
45
|
|
|
@@ -82,26 +83,30 @@ Just create a `poops.json` file in the root of your project and add the followin
|
|
|
82
83
|
|
|
83
84
|
```json
|
|
84
85
|
{
|
|
85
|
-
"scripts": [
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
"
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
86
|
+
"scripts": [
|
|
87
|
+
{
|
|
88
|
+
"in": "example/src/js/main.ts",
|
|
89
|
+
"out": "example/dist/js/scripts.js",
|
|
90
|
+
"options": {
|
|
91
|
+
"sourcemap": true,
|
|
92
|
+
"minify": true,
|
|
93
|
+
"justMinified": false,
|
|
94
|
+
"format": "iife",
|
|
95
|
+
"target": "es2019"
|
|
96
|
+
}
|
|
94
97
|
}
|
|
95
|
-
|
|
96
|
-
"styles": [
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
"
|
|
101
|
-
|
|
102
|
-
|
|
98
|
+
],
|
|
99
|
+
"styles": [
|
|
100
|
+
{
|
|
101
|
+
"in": "example/src/scss/index.scss",
|
|
102
|
+
"out": "example/dist/css/styles.css",
|
|
103
|
+
"options": {
|
|
104
|
+
"sourcemap": true,
|
|
105
|
+
"minify": true,
|
|
106
|
+
"justMinified": false
|
|
107
|
+
}
|
|
103
108
|
}
|
|
104
|
-
|
|
109
|
+
],
|
|
105
110
|
"markup": {
|
|
106
111
|
"in": "example/src/markup",
|
|
107
112
|
"out": "/",
|
|
@@ -120,24 +125,20 @@ Just create a `poops.json` file in the root of your project and add the followin
|
|
|
120
125
|
]
|
|
121
126
|
}
|
|
122
127
|
},
|
|
123
|
-
|
|
128
|
+
"copy": [
|
|
124
129
|
{
|
|
125
130
|
"in": "example/src/static",
|
|
126
131
|
"out": "example/dist"
|
|
127
132
|
}
|
|
128
133
|
],
|
|
129
134
|
"banner": "/* {{ name }} v{{ version }} | {{ homepage }} | {{ license }} License */",
|
|
130
|
-
"serve"
|
|
135
|
+
"serve": {
|
|
131
136
|
"port": 4040,
|
|
132
137
|
"base": "/"
|
|
133
138
|
},
|
|
134
139
|
"livereload": true,
|
|
135
|
-
"watch": [
|
|
136
|
-
|
|
137
|
-
],
|
|
138
|
-
"includePaths": [
|
|
139
|
-
"node_modules"
|
|
140
|
-
]
|
|
140
|
+
"watch": ["src"],
|
|
141
|
+
"includePaths": ["node_modules"]
|
|
141
142
|
}
|
|
142
143
|
```
|
|
143
144
|
|
|
@@ -147,19 +148,20 @@ You can freely remove the properties that you don't need. For example, if you do
|
|
|
147
148
|
|
|
148
149
|
### Scripts
|
|
149
150
|
|
|
150
|
-
Scripts are bundled with [esbuild](https://esbuild.github.io/). You can specify multiple scripts to bundle. Each script has the following properties:
|
|
151
|
+
Scripts are bundled with [esbuild](https://esbuild.github.io/). Supports `.js`, `.ts`, `.jsx`, and `.tsx` files out of the box — including React and other JSX frameworks. You can specify multiple scripts to bundle. Each script has the following properties:
|
|
151
152
|
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
- `in` - the input path, can be an array of file paths, but please just use one file path per script
|
|
154
|
+
- `out` - the output path, can be a directory or a file path, but please just use it as a filename
|
|
155
|
+
- `options` - the options for the bundler. You can apply most of the esbuild options that are not in conflict with Poops. See [esbuild's options](https://esbuild.github.io/api/#build-api) for more info.
|
|
155
156
|
|
|
156
157
|
**Options:**
|
|
157
|
-
* `sourcemap` - whether to generate sourcemaps or not, sourcemaps are generated only for non-minified files since they are useful for debugging. Default is `false`. This is a direct esbuild option
|
|
158
|
-
* `minify` - whether to minify the output or not, minification is performed by `esbuild` and is only applied to non-minified files. Default is `false`
|
|
159
|
-
* `justMinified` - whether you want to have a minified file as output only. Removes the non-minified file from the output. Useful for production builds. Default is `false`
|
|
160
|
-
* `format` - the output format, can be `iife` or `esm` or `cjs` - this is a direct esbuild option
|
|
161
|
-
* `target` - the target for the output, can be `es2018` or `es2019` or `es2020` or `esnext` for instance - this is a direct esbuild option
|
|
162
158
|
|
|
159
|
+
- `sourcemap` - whether to generate sourcemaps or not, sourcemaps are generated only for non-minified files since they are useful for debugging. Default is `false`. This is a direct esbuild option
|
|
160
|
+
- `minify` - whether to minify the output or not, minification is performed by `esbuild` and is only applied to non-minified files. Default is `false`
|
|
161
|
+
- `justMinified` - whether you want to have a minified file as output only. Removes the non-minified file from the output. Useful for production builds. Default is `false`
|
|
162
|
+
- `format` - the output format, can be `iife` or `esm` or `cjs` - this is a direct esbuild option
|
|
163
|
+
- `target` - the target for the output, can be `es2018` or `es2019` or `es2020` or `esnext` for instance - this is a direct esbuild option
|
|
164
|
+
- `jsx` - the JSX transform mode, can be `transform` (default) or `automatic`. Use `automatic` for React 17+ JSX runtime which doesn't require importing React in every file - this is a direct esbuild option
|
|
163
165
|
|
|
164
166
|
`scripts` property can accept an array of script configurations or just a single script configuration. If you want to bundle multiple scripts, just add them to the `scripts` array:
|
|
165
167
|
|
|
@@ -192,20 +194,90 @@ Scripts are bundled with [esbuild](https://esbuild.github.io/). You can specify
|
|
|
192
194
|
}
|
|
193
195
|
```
|
|
194
196
|
|
|
197
|
+
#### JSX/TSX (React) Example
|
|
198
|
+
|
|
199
|
+
To bundle a React app, just point `in` to your `.jsx` or `.tsx` entry file:
|
|
200
|
+
|
|
201
|
+
```json
|
|
202
|
+
{
|
|
203
|
+
"scripts": [
|
|
204
|
+
{
|
|
205
|
+
"in": "src/js/app.jsx",
|
|
206
|
+
"out": "dist/js/app.js",
|
|
207
|
+
"options": {
|
|
208
|
+
"minify": true,
|
|
209
|
+
"format": "iife",
|
|
210
|
+
"jsx": "automatic"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
]
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
Setting `jsx` to `automatic` uses React's JSX runtime (React 17+), so you don't need `import React from 'react'` in every file. If you omit `jsx` or set it to `transform`, the classic `React.createElement` transform is used.
|
|
218
|
+
|
|
195
219
|
As noted earlier, if you don't want to bundle scripts, just remove the `scripts` property from the config.
|
|
196
220
|
|
|
221
|
+
### React SSG (Static Site Generation)
|
|
222
|
+
|
|
223
|
+
SSG renders React components to HTML at build time, then hydrates them on the client. This means pages load with pre-rendered content instead of an empty `<div>`.
|
|
224
|
+
|
|
225
|
+
Each SSG entry has the following properties:
|
|
226
|
+
|
|
227
|
+
- `component` — the file that default-exports a React component (rendered server-side)
|
|
228
|
+
- `in` — the client entry file for hydration (bundled for browser)
|
|
229
|
+
- `out` — output path for the client bundle
|
|
230
|
+
- `inject` — Nunjucks variable name for the rendered HTML
|
|
231
|
+
- `options` — esbuild options (applied to the client bundle, same as `scripts` options)
|
|
232
|
+
|
|
233
|
+
```json
|
|
234
|
+
{
|
|
235
|
+
"ssg": [
|
|
236
|
+
{
|
|
237
|
+
"component": "src/js/App.jsx",
|
|
238
|
+
"in": "src/js/app-hydrate.jsx",
|
|
239
|
+
"out": "dist/js/app-hydrate.js",
|
|
240
|
+
"inject": "app_html",
|
|
241
|
+
"options": {
|
|
242
|
+
"minify": true,
|
|
243
|
+
"target": "es2019"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
]
|
|
247
|
+
}
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
In your Nunjucks templates, use the `inject` name to insert the rendered HTML:
|
|
251
|
+
|
|
252
|
+
```html
|
|
253
|
+
<div id="root">{{ app_html | safe }}</div>
|
|
254
|
+
<script src="js/app-hydrate.min.js"></script>
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
**How it works:**
|
|
258
|
+
|
|
259
|
+
1. Poops bundles the component with `react-dom/server` for Node.js and calls `renderToString`
|
|
260
|
+
2. The rendered HTML is stored and made available as a Nunjucks global variable
|
|
261
|
+
3. The client entry is bundled for the browser (same as a regular `scripts` entry)
|
|
262
|
+
4. At runtime, React hydrates the pre-rendered HTML, making it interactive
|
|
263
|
+
|
|
264
|
+
SSG runs after Styles but before Scripts and Markups in the build pipeline. Poops does not need `react` or `react-dom` as its own dependency — they are resolved from your project's `node_modules`.
|
|
265
|
+
|
|
266
|
+
In watch mode, changes to JSX/TSX files trigger SSG re-rendering followed by a markup recompile.
|
|
267
|
+
|
|
197
268
|
### Styles
|
|
198
269
|
|
|
199
270
|
Styles are bundled with [Dart Sass](https://sass-lang.com/dart-sass). You can specify multiple styles to bundle. Each style has the following properties:
|
|
200
271
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
272
|
+
- `in` - the input path, accepts only a path to a file
|
|
273
|
+
- `out` - the output path, can be a directory or a file path, but please just use it as a filename
|
|
274
|
+
- `options` - the options for the bundler.
|
|
204
275
|
|
|
205
276
|
**Options:**
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
277
|
+
|
|
278
|
+
- `sourcemap` - whether to generate sourcemaps or not, sourcemaps are generated only for non-minified files since they are useful for debugging. Default is `false`
|
|
279
|
+
- `minify` - whether to minify the output or not, minification is performed by `esbuild`. Default is `false`
|
|
280
|
+
- `justMinified` - whether you want to have a minified file as output only. Removes the non-minified file from the output. Useful for production builds. Defaults to `false`.
|
|
209
281
|
|
|
210
282
|
`styles` property can accept an array of style configurations or just a single style configuration. If you want to bundle multiple styles, just add them to the `styles` array:
|
|
211
283
|
|
|
@@ -238,17 +310,16 @@ As noted earlier, if you don't want to bundle styles, just remove the `styles` p
|
|
|
238
310
|
|
|
239
311
|
### Markups 🚧
|
|
240
312
|
|
|
241
|
-
Poops can generate static pages for you. This feature is still under development, but available for testing from the
|
|
313
|
+
Poops can generate static pages for you. This feature is still under development, but available for testing from the v1.0.2. Your markup is templated with [nunjucks](https://mozilla.github.io/nunjucks/). You can specify multiple markup directories to template. **It's currently recommended to specify only one markup directory since this feature is still WIP 🚧.** Each markup directory has the following properties:
|
|
242
314
|
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
315
|
+
- `in` - the input path, can be a directory or a file path, but please just use it as a directory path for now. All files in this directory will be processed and the structure of the directory will be preserved in the output directory with exception to directories that begin with an underscore `_` will be ignored.
|
|
316
|
+
- `out` - the output path, can be only a directory path (for now)
|
|
317
|
+
- `site` (optional) - global data that will be available to all templates in the markup directory. Like site title, description, social media links, etc. You can then use this data in your templates `{{ site.title }}` for instance.
|
|
318
|
+
- `data` (optional) - is an array of JSON or YAML data files, that once loaded will be available to all templates in the markup directory. If you provide a path to a file for instance `links.json` with a `facebook` property, you can then use this data in your templates `{{ links.facebook }}`. The base name of the file will be used as the variable name, with spaces, dashes and dots replaced with underscores. So `the awesome-links.json` will be available as `{{ the_awesome_links.facebook }}` in your templates. The root directory of the data files is `in` directory. So if you have a `data` directory in your `in` directory, you can specify the data files like this `data: ["data/links.json"]`. The same goes for the YAML files.
|
|
319
|
+
- `includePaths` - an array of paths to directories that will be added to the nunjucks include paths. Useful if you want to separate template partials and layouts. For instance, if you have a `_includes` directory with a `header.njk` partial that you want to include in your markup, you can add it to the include paths and then include the templates like this `{% include "header.njk" %}`, without specifying the full path to the partial. This will change in the future, to provide better ignore and include patterns for the markup directories.
|
|
248
320
|
|
|
249
321
|
**💡 NOTE:** If, for instance, you are building a simple static onepager for your library, and want to pass a version variable from your `package.json`, Poops automatically reads your `package.json` if it exists in your working directory and sets the global variable `package` to the parsed JSON. So you can use it in your markup files, for example like this: `{{ package.version }}`.
|
|
250
322
|
|
|
251
|
-
|
|
252
323
|
Here is a sample markup configuration:
|
|
253
324
|
|
|
254
325
|
```JSON
|
|
@@ -277,13 +348,13 @@ If your project doesn't have markups, you can remove the `markups` property from
|
|
|
277
348
|
|
|
278
349
|
#### Custom Filters
|
|
279
350
|
|
|
280
|
-
|
|
351
|
+
- `slugify` - slugifies a string. Usage: `{{ "My Awesome Title" | slugify }}` will output `my-awesome-title`
|
|
281
352
|
|
|
282
353
|
### Copy
|
|
283
354
|
|
|
284
355
|
Configuration entry to copy files or directories - copy your static files like images and fonts, for instance, from `src` to `dist` directory. This feature was added to enable moving static files if you deploy GitHub pages via a GitHub action. If you don't want to use this feature, simply exclude the `copy` property from your config file.
|
|
285
356
|
|
|
286
|
-
Here is a sample copy configuration which will copy the `static` directory and it's contents to the
|
|
357
|
+
Here is a sample copy configuration which will copy the `static` directory and it's contents to the `dist` directory:
|
|
287
358
|
|
|
288
359
|
```JSON
|
|
289
360
|
{
|
|
@@ -322,7 +393,7 @@ You can specify a list of input paths and pass them to an output directory, for
|
|
|
322
393
|
}
|
|
323
394
|
```
|
|
324
395
|
|
|
325
|
-
**💡 NOTE:** Copy can also accept
|
|
396
|
+
**💡 NOTE:** Copy can also accept **GLOB** and **EXTGLOB** patterns as input paths, except POSIX character classes (e.g. `[[:alpha:]]`):
|
|
326
397
|
|
|
327
398
|
```JSON
|
|
328
399
|
{
|
|
@@ -333,6 +404,9 @@ You can specify a list of input paths and pass them to an output directory, for
|
|
|
333
404
|
"notes/doc?.txt",
|
|
334
405
|
"notes/memo*.txt",
|
|
335
406
|
"notes/log[!123a].txt",
|
|
407
|
+
"assets/!(vendor)/*.js",
|
|
408
|
+
"fonts/@(woff|woff2)/*.+(woff|woff2)",
|
|
409
|
+
"docs/?(intro|overview).md"
|
|
336
410
|
],
|
|
337
411
|
"out": "dist"
|
|
338
412
|
}
|
|
@@ -343,14 +417,15 @@ You can specify a list of input paths and pass them to an output directory, for
|
|
|
343
417
|
|
|
344
418
|
Here you can specify a banner that will be added to the top of the output files. It is templatable via mustache. The following variables are available from your project's `package.json`:
|
|
345
419
|
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
420
|
+
- `name`
|
|
421
|
+
- `version`
|
|
422
|
+
- `homepage`
|
|
423
|
+
- `license`
|
|
424
|
+
- `author`
|
|
425
|
+
- `description`
|
|
352
426
|
|
|
353
427
|
Here is a sample banner template.
|
|
428
|
+
|
|
354
429
|
```
|
|
355
430
|
/* {{ name }} v{{ version }} | {{ homepage }} | {{ license }} License */
|
|
356
431
|
```
|
|
@@ -360,20 +435,24 @@ You can always pass just a string, you don't have to template it.
|
|
|
360
435
|
If you don't want to add a banner, just remove the `banner` property from the config.
|
|
361
436
|
|
|
362
437
|
### Local Server (optional)
|
|
438
|
+
|
|
363
439
|
Sets up a local server for your project.
|
|
364
440
|
|
|
365
441
|
Server options:
|
|
366
|
-
|
|
367
|
-
|
|
442
|
+
|
|
443
|
+
- `port` - the port on which the server will run
|
|
444
|
+
- `base` - the base path of the server, where your HTML files are located
|
|
368
445
|
|
|
369
446
|
If you don't want to run a local server, just remove the `serve` property from the config.
|
|
370
447
|
|
|
371
448
|
### Live Reload (optional)
|
|
449
|
+
|
|
372
450
|
Sets up a livereload server for your project.
|
|
373
451
|
|
|
374
452
|
Live reload options:
|
|
375
|
-
|
|
376
|
-
|
|
453
|
+
|
|
454
|
+
- `port` - the port on which the livereload server will run
|
|
455
|
+
- `exclude` - an array of files and directories to exclude from livereload
|
|
377
456
|
|
|
378
457
|
`livereload` can only be `true`, which means that it will run on the default port (`35729`) or you can specify a port:
|
|
379
458
|
|
|
@@ -390,10 +469,7 @@ You can also exclude files and directories from livereload:
|
|
|
390
469
|
```json
|
|
391
470
|
{
|
|
392
471
|
"livereload": {
|
|
393
|
-
"exclude": [
|
|
394
|
-
"some_directory/**/*",
|
|
395
|
-
"some_other_directory/**/*"
|
|
396
|
-
]
|
|
472
|
+
"exclude": ["some_directory/**/*", "some_other_directory/**/*"]
|
|
397
473
|
}
|
|
398
474
|
}
|
|
399
475
|
```
|
|
@@ -401,10 +477,14 @@ You can also exclude files and directories from livereload:
|
|
|
401
477
|
In order for Livereload to work, you need to add the following script snippet to your HTML files in your development environment:
|
|
402
478
|
|
|
403
479
|
```html
|
|
404
|
-
<script>
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
480
|
+
<script>
|
|
481
|
+
document.write(
|
|
482
|
+
'<script src="http://' +
|
|
483
|
+
(location.host || "localhost").split(":")[0] +
|
|
484
|
+
':35729/livereload.js?snipver=1"></' +
|
|
485
|
+
"script>",
|
|
486
|
+
);
|
|
487
|
+
</script>
|
|
408
488
|
```
|
|
409
489
|
|
|
410
490
|
Be mindful of the port, if you have specified a custom port, you need to change the port in the snippet as well.
|
|
@@ -414,56 +494,52 @@ You can also use a browser extension for livereload, for instance here is one fo
|
|
|
414
494
|
If you don't want to run livereload, just remove the `livereload` property from the config, or set it to false.
|
|
415
495
|
|
|
416
496
|
### Watch (optional)
|
|
497
|
+
|
|
417
498
|
Sets up a watcher for your project which will rebuild your files on change.
|
|
418
499
|
|
|
419
500
|
`watch` property accepts an array of paths to watch for changes. If you want to watch for changes in the `src` directory, just add it to the `watch` array:
|
|
420
501
|
|
|
421
502
|
```json
|
|
422
503
|
{
|
|
423
|
-
"watch": [
|
|
424
|
-
"src"
|
|
425
|
-
]
|
|
504
|
+
"watch": ["src"]
|
|
426
505
|
}
|
|
427
506
|
```
|
|
428
507
|
|
|
429
508
|
If you don't want to watch for file changes, just remove the `watch` property from the config.
|
|
430
509
|
|
|
431
510
|
### Include Paths (optional)
|
|
511
|
+
|
|
432
512
|
This property is used to specify paths that you want to resolve your imports from. Like `node_modules`. You don't need to specify the `includePaths`, `node_modules` are included by default. But if you do specify `includePaths`, you need to include `node_modules` as well, since this change will override the default behavior.
|
|
433
513
|
|
|
434
514
|
Same as `watch` property, `includePaths` accepts an array of paths to include. If you want to include `lib` directory for instance, just add it to the `includePaths` array:
|
|
435
515
|
|
|
436
516
|
```json
|
|
437
517
|
{
|
|
438
|
-
"includePaths": [
|
|
439
|
-
"node_modules", "lib"
|
|
440
|
-
]
|
|
518
|
+
"includePaths": ["node_modules", "lib"]
|
|
441
519
|
}
|
|
442
520
|
```
|
|
443
521
|
|
|
444
522
|
## Todo
|
|
445
523
|
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
* [x] RSS and ATOM generation for collections
|
|
460
|
-
* [ ] Refactor!!!!
|
|
524
|
+
- [ ] Run esbuild for each input path individually if there are multiple input paths
|
|
525
|
+
- [ ] Styles `in` should be able to support array of inputs like we have it on scripts
|
|
526
|
+
- [ ] Build a cli config creation helper tool. If the user doesn't have a config file, we can ask them a few questions and create a config file for them. Create Yeoman generator for poops projects.
|
|
527
|
+
- [x] Add nunjucks static templating
|
|
528
|
+
- [ ] Refactor nunjucks implementation
|
|
529
|
+
- [ ] Complete documentation for nunjucks
|
|
530
|
+
- [x] Add markdown support
|
|
531
|
+
- [x] Front Matter support
|
|
532
|
+
- [x] Future implementation: posts and custom collections, so we can have a real static site generator
|
|
533
|
+
- [x] Collection pagination system
|
|
534
|
+
- [x] Post published toggle
|
|
535
|
+
- [x] RSS and ATOM generation for collections
|
|
536
|
+
- [ ] Support for images and creating srcsets
|
|
461
537
|
|
|
462
538
|
## Why?
|
|
463
539
|
|
|
464
540
|
Why doesn't anyone maintain GULP anymore? Why does Parcel hate config files? Why are Rollup and Webpack so complex to setup for simple tasks? Vite???? What's going on?
|
|
465
541
|
|
|
466
|
-
I'm tired... Tired of bullshit... I just want to bundle my scss/sass and/or my js/ts to css and iife/esm js, by providing input and output paths for both/one. And to be able to have minimal easily maintainable dependencies. I don't need plugins, I'll add the features manually for the practice I use. That's it. The f
|
|
542
|
+
I'm tired... Tired of bullshit... I just want to bundle my scss/sass and/or my js/ts to css and iife/esm js, by providing input and output paths for both/one. And to be able to have minimal easily maintainable dependencies. I don't need plugins, I'll add the features manually for the practice I use. That's it. The f\*\*king end.
|
|
467
543
|
|
|
468
544
|
To better illustrate it, here is a sample diff of Poops replacing Rollup:
|
|
469
545
|
|
package/lib/copy.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const fs = require('node:fs')
|
|
4
|
-
const path = require('node:path')
|
|
5
|
-
const PrintStyle = require('./utils/print-style.js')
|
|
6
|
-
|
|
7
|
-
const {
|
|
1
|
+
import { globSync, hasMagic } from 'glob'
|
|
2
|
+
import {
|
|
8
3
|
pathExists,
|
|
9
4
|
pathIsDirectory,
|
|
10
5
|
mkDir,
|
|
11
6
|
copyDirectory,
|
|
12
7
|
buildTime
|
|
13
|
-
}
|
|
8
|
+
} from './utils/helpers.js'
|
|
9
|
+
import fs from 'node:fs'
|
|
10
|
+
import path from 'node:path'
|
|
11
|
+
import PrintStyle from './utils/print-style.js'
|
|
14
12
|
|
|
15
13
|
const pstyle = new PrintStyle()
|
|
16
14
|
|
|
17
|
-
|
|
15
|
+
export default class Copy {
|
|
18
16
|
constructor(config) {
|
|
19
17
|
this.config = config
|
|
20
18
|
}
|
|
@@ -101,7 +99,7 @@ module.exports = class Copy {
|
|
|
101
99
|
|
|
102
100
|
if (pathExists(outputFilePath)) {
|
|
103
101
|
if (pathIsDirectory(outputFilePath)) {
|
|
104
|
-
fs.
|
|
102
|
+
fs.rmSync(outputFilePath, { recursive: true })
|
|
105
103
|
return
|
|
106
104
|
}
|
|
107
105
|
fs.unlinkSync(outputFilePath)
|