Giter VIP home page Giter VIP logo

Comments (6)

gobeli avatar gobeli commented on June 15, 2024

Unfortunately I can't reproduce that error, what does your eleventyConfig look like?

from eleventy-plugin-svelte.

nemo-omen avatar nemo-omen commented on June 15, 2024

Here it is (I have to admit to not knowing much about configuring either eleventy or rollup):
`const syntaxHighlight = require('@11ty/eleventy-plugin-syntaxhighlight');
const markdownIt = require('markdown-it');
const markDownItClass = require('@toycode/markdown-it-class');
const EleventySvelte = require('eleventy-plugin-svelte');
const postcss = require('rollup-plugin-postcss');
const terser = require('rollup-plugin-terser').terser;

const dev = process.env.NODE_ENV === 'development'

const md = markdownIt({linkify: true, html: true});

module.exports = function (eleventyConfig) {
eleventyConfig.addWatchTarget("./_tmp/style.css");
eleventyConfig.addPassthroughCopy({ "./_tmp/style.css": "./css/style.css" });
eleventyConfig.addPassthroughCopy('src/css');
eleventyConfig.addPassthroughCopy('src/js');
eleventyConfig.addPassthroughCopy('src/img');
eleventyConfig.addPlugin(syntaxHighlight);

eleventyConfig.addPlugin(EleventySvelte, {
    rollupPluginSvelteSSROptions: {
        dev,
    },
    rollupPluginSvelteClientOptions: {
        dev,
        emitCss: true,
    },
    rollupClientPlugins: [postcss(), !dev && terser()],
});

eleventyConfig.addShortcode("version", function () {
    return String(Date.now());
  });

return {
    dir: {
        input: 'src',
        // templateFormats: ['md', 'njk', 'svelte']
        // includes: 'includes',
        // layouts: 'layouts'
    },
    passthroughFileCopy: true
}

}`

from eleventy-plugin-svelte.

nemo-omen avatar nemo-omen commented on June 15, 2024

It looks like it's happening when I try to specify the main.njk layout in the frontmatter of the md file. when I leave it out it processes the md file with no layout.

I've tried specifying a 11ty.svelte file as a layout for the markdown, which I know is not a feature, but it does process the layout file with no templateContent data. So ... I'm guessing I need to figure out how to access templateContent.

from eleventy-plugin-svelte.

nemo-omen avatar nemo-omen commented on June 15, 2024

Oh, hey, it's right there on data._templateContent!

I think I just misunderstood how to specify templates for markdown files. As long as I provide a 11ty.svelte file for the markdown template I should be able to access all of the template's data.

from eleventy-plugin-svelte.

gobeli avatar gobeli commented on June 15, 2024

Oh I could reproduce it now. You shouldn't have to jump through all these hoops to get there. The problem is, that the shortcode to load the svelte client tries to find the component but obviously can't find one for the md file. I'll publish a fix!

from eleventy-plugin-svelte.

gobeli avatar gobeli commented on June 15, 2024

The fix is up in version 1.0.4

from eleventy-plugin-svelte.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.