GithubHelp home page GithubHelp logo

Comments (2)

tnylea avatar tnylea commented on September 14, 2024

@megavolkan you're correct that should be hot reloading when a change is made; however, that's not what is happening.

You can see that inside of src/dev.js https://github.com/thedevdojo/static/blob/main/src/dev.js#L32

We are specifying the extensions we want to watch for:

const liveReloadOptions = {
    port: liveReloadAvailablePort,
    exts: ['html', 'css', 'js', 'png', 'gif', 'jpg', 'md']
};

In the next lines we create the LiveReload server and loop through a few folders to watch for:

const liveReloadServer = livereload.createServer(liveReloadOptions);

for(let i = 0; i < staticFoldersToWatch.length; i++){
    liveReloadServer.watch(currentDirectory + "/" + staticFoldersToWatch[i] + "/**/*");
}

The assets folder is inside of the staticFoldersToWatch array at the top of the file:

const staticFoldersToWatch = ['assets', 'collections', 'content', 'includes', 'layouts', 'pages', 'public'];

So, you are correct that it is not working as intended.

The weird thing is that I can add a file at /assets/css/test.html and when I make updates to that file it livereloads. So for some reason it's not respecting the exts list.

I've double checked that this is the recommended way to use this library. Here is the livereload library that Static is using:
https://www.npmjs.com/package/livereload
https://github.com/napcs/node-livereload

I've spent about an hour trying to debug with no luck, so I'll have to give it another try soon and dig a little deeper.

Feel free to try and debug if you have some extra time. To do so you can git clone this repo onto your machine and run npm install

https://github.com/thedevdojo/static.git
cd static
npm install

Then, you can run:

npm link

This command will link the code from that folder to the static command. When you want to unlink you can run:

npm unlink

No worries if you can't debug. I'll be sure to give it another debugging try over the weekend 🤜🤛

Talk to you soon.

from static.

megavolkan avatar megavolkan commented on September 14, 2024

Hi, is there any progress? I have tried a few thing, yet they did not work either. Removed tailwind altogether (not a huge fan o it). Added additional .css files to the /assets folder and run 'static build' but additional css files are not compiled into the _site folder, only main.css. I suppose build process is not watching /assets/css folder other than main.css file. On the other hand /assets/js folder is watched and compiled without a problem. I really do want to use Static, for its simplicity, file based routing and other bells and whistles but I think it has a long way ahead.

from static.

Related Issues (14)

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.