[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Babel zip after exporting file

From: suarezmiguelc
Subject: Babel zip after exporting file
Date: Thu, 16 Mar 2023 23:39:13 +0100

Hello Emacs org-mode community, I’m trying this example:

** index.js
:header-args: :tangle index.js :post-tangle (shell-command-to-string "zip 
index.js.zip index.js && rm index.js")

First endpoint example:

#+begin_src js
exports.handler = async (event, context) => {
  console.log('Received event:', JSON.stringify(event, null, 2));
  return {
    statusCode: 200,
    headers: {
      'Content-Type': 'application/json'
    body: JSON.stringify({
      message: 'Hello, world!'

What I want is to:
1. Tangle the index.js file
2. Zip it as index.js.zip
3. Delete the raw code index.js

The thing is that, the command inserted in :post-tangle is executed before the 
creation of the file, so it only works if the file already exists, so:
- First run, file doesn’t exist, only index.js is generated.
- Second run, zip file appears, index.js is intact since the rm index.js 
command ran but then index.js was generated again.

How should I debug this?

reply via email to

[Prev in Thread] Current Thread [Next in Thread]