frigjord
frigjord
DDeno
Created by frigjord on 11/22/2024 in #help
Tailwind V4 Beta 1
The same works in Tailwind V3, but here it produces 22KB of unrelated styles.
import postcss from "npm:postcss";
import tailwindcss from "npm:@tailwindcss/postcss@next";

const tailwindBaseConfig = {
content: [{ raw: '<div class="text-red-500"></div>', extension: "html" }],
corePlugins: { preflight: false },
};

async function generateCSS(tailwindConfig) {
try {
const tailwindDirectives = `
@tailwind components;
@tailwind utilities;
`;

console.log('Config:', JSON.stringify(tailwindConfig, null, 2));
console.log('Directives:', tailwindDirectives);

const result = await postcss([tailwindcss(tailwindConfig)])
.process(tailwindDirectives, { from: undefined });
return result.css;
} catch (error) {
console.error("Error generating CSS:", error);
throw error;
}
}

// Run the test
console.log('Starting CSS generation...');
const css = await generateCSS(tailwindBaseConfig);
console.log('\nFinal CSS Size:', Math.round(css.length/1000)+' KB');
import postcss from "npm:postcss";
import tailwindcss from "npm:@tailwindcss/postcss@next";

const tailwindBaseConfig = {
content: [{ raw: '<div class="text-red-500"></div>', extension: "html" }],
corePlugins: { preflight: false },
};

async function generateCSS(tailwindConfig) {
try {
const tailwindDirectives = `
@tailwind components;
@tailwind utilities;
`;

console.log('Config:', JSON.stringify(tailwindConfig, null, 2));
console.log('Directives:', tailwindDirectives);

const result = await postcss([tailwindcss(tailwindConfig)])
.process(tailwindDirectives, { from: undefined });
return result.css;
} catch (error) {
console.error("Error generating CSS:", error);
throw error;
}
}

// Run the test
console.log('Starting CSS generation...');
const css = await generateCSS(tailwindBaseConfig);
console.log('\nFinal CSS Size:', Math.round(css.length/1000)+' KB');
2 replies
DDeno
Created by frigjord on 10/15/2023 in #help
How can i change the location of Cache.open('somedb')
We're deploying to docker containers which needs to write to an attached volume (specific path)
3 replies
DDeno
Created by frigjord on 6/30/2023 in #help
Can't connect to http server on official alpine deno with std serve.
I'm using the official alpine docker container to run deno, listening on port 8080, but a simple curl to it and I can't connect. Seems like it isn't listening at all. Deno server shows no error.
# Use the official Deno Docker image with version 1.32.0
FROM denoland/deno:alpine-1.32.0

# Set the working directory inside the container
WORKDIR /app

# Copy the necessary files to the container
COPY . .

RUN deno cache --lock=deno.lock --lock-write deps.ts
RUN deno cache --lock=deno.lock --lock-write server.js
RUN apk add vim curl

# Allow network access to the application
EXPOSE 8080

# Set the entrypoint command to run the Deno application
CMD ["deno", "run", "--allow-net", "--allow-env", "server.js"]
# Use the official Deno Docker image with version 1.32.0
FROM denoland/deno:alpine-1.32.0

# Set the working directory inside the container
WORKDIR /app

# Copy the necessary files to the container
COPY . .

RUN deno cache --lock=deno.lock --lock-write deps.ts
RUN deno cache --lock=deno.lock --lock-write server.js
RUN apk add vim curl

# Allow network access to the application
EXPOSE 8080

# Set the entrypoint command to run the Deno application
CMD ["deno", "run", "--allow-net", "--allow-env", "server.js"]
Using https://deno.land/std@0.123.0/http/server.ts works fine on local dev.
13 replies
DDeno
Created by frigjord on 5/9/2023 in #help
Increase http server timeout?
How do i increase the timeout? Seems to be ~120 seconds by default, but we have longer running requests than that.
1 replies
DDeno
Created by frigjord on 2/5/2023 in #help
How to get remote IP address when using Deno.serve?
I'm using connInfo when using Deno from STD but the native http server doesn't seem to have such interface, since it's undefined via the handler.
6 replies
DDeno
Created by frigjord on 1/23/2023 in #help
How to disable deno linter for whole project directory?
I'm using deno with mixed project folders, some use Vue and shouldn't be linted by deno. How do i disable it for the project folder?
32 replies
DDeno
Created by frigjord on 10/29/2022 in #help
How to get complete Deno RAM usage?
Do we use Deno.memoryUsage().rss or should it be rss+heapUsed+external?
5 replies
DDeno
Created by frigjord on 9/30/2022 in #help
How to setup CORS with serve? I get 403 forbidden.
I've setup the following headers (OPTIONS response):
new Response(null, {
status: 204,
headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', 'Access-Control-Allow-Headers': '*' }
})
new Response(null, {
status: 204,
headers: { 'Access-Control-Allow-Origin': '*', 'Access-Control-Allow-Methods': 'GET, POST, OPTIONS', 'Access-Control-Allow-Headers': '*' }
})
I'm getting 403 when the request has Access-Control-Request-Method: OPTIONS. Which is what the browser send. Without that, it replies with 204 as expected.
1 replies