Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
VagueRant
May 24, 2012
How do you guys incorporate locally hosted fonts into site build processes? (And what formats do you use?)

I'm using Laravel Mix as part of a build, wanted to just leave fonts in the /public directory with the images, but when webpack/postcss gets the to the font-face in my CSS it tries to resolve the URLs and breaks on me.

Not sure if I'm just missing loaders/steps, or if I should be working off a different structure altogether.

Adbot
ADBOT LOVES YOU

barkbell
Apr 14, 2006

woof
Building a marketing site built in nextjs deploying to netlify. I don't really want to track assets in git, what is the normal solution for managing assets?

prom candy
Dec 16, 2005

Only I may dance
Like content images in a hard-coded website? I put them in the repo

smackfu
Jun 7, 2004

git-lfs?

barkbell
Apr 14, 2006

woof

prom candy posted:

Like content images in a hard-coded website? I put them in the repo

ya i can do this now but im thinking eventually id like to move away from that

smackfu posted:

git-lfs?

this is neat

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!
Is there honestly no simple way to hook into the 'back' button in an Angular SPA? I just want to say "oh hey you got to the page from the back button? OK do foo() oh you got here some other way, do bar(). However anything I see, outright doesn't work because of Angular API changes, or requires a subscription, which I guess sometimes never returns anything so neither foo() nor bar() happen and the whole page breaks.

Basically page A has content that is populated onScroll, but the user case is going to page B then BACK TO A, but the scroll position isn't maintained partially because not saved, but also because the content isn't there.

EDIT I guess I can put a hostlistener on the app and then subscribe to that?

The Merkinman fucked around with this message at 01:04 on Feb 4, 2021

The Merkinman
Apr 22, 2007

I sell only quality merkins. What is a merkin you ask? Why, it's a wig for your genitals!

The Merkinman posted:

Is there honestly no simple way to hook into the 'back' button in an Angular SPA? I just want to say "oh hey you got to the page from the back button? OK do foo() oh you got here some other way, do bar(). However anything I see, outright doesn't work because of Angular API changes, or requires a subscription, which I guess sometimes never returns anything so neither foo() nor bar() happen and the whole page breaks.

Basically page A has content that is populated onScroll, but the user case is going to page B then BACK TO A, but the scroll position isn't maintained partially because not saved, but also because the content isn't there.

EDIT I guess I can put a hostlistener on the app and then subscribe to that?

Going back to my older project with Vue, seems like even the 4th version no longer works now? I Guess I didn't actively touch it for every dependency that npm has so now it just magically broke. Guess I'm back to square 1 and just telling my employer "welp I guess want I want is literally impossible since I've scoured the internet and cannot find a single working example of both publishing a library and using it that actually works in TYOOL 2021"

AlphaKeny1 did you ever get something that actually worked?


AND I did quote != edit. Maybe I'm just too inept to use computers at all!

Nolgthorn
Jan 30, 2001

The pendulum of the mind alternates between sense and nonsense
Not sure about the back button on angular, but I know vue you can detect that sort of thing. You could listen to the `pageshow` event, apparently the value of `persisted` will tell you that it was because of the back button? I'm not sure, it's probably used for something other than that.

https://developer.mozilla.org/en-US/docs/Web/API/Window/pageshow_event

Vue broke for me once, it was a process to get it up to date since the latest versions no longer supported anything but awful awful webpack for building. So I had to change all of the tooling along with upgrading the application.

I feel your pain re npm it's not just you.

Full Circle
Feb 20, 2008

Any React devs currently using ant-design might want to start planning an exit strategy. Their GitHub repo was deleted without warning over the weekend, and it is now hosted exclusively on the CCP-funded gitee.

prom candy
Dec 16, 2005

Only I may dance

Full Circle posted:

Any React devs currently using ant-design might want to start planning an exit strategy. Their GitHub repo was deleted without warning over the weekend, and it is now hosted exclusively on the CCP-funded gitee.


GitHub is owned by Microsoft and works (worked?) with ICE so like... there's no ethical version control under capitalism.

Full Circle
Feb 20, 2008

prom candy posted:

GitHub is owned by Microsoft and works (worked?) with ICE so like... there's no ethical version control under capitalism.

That's a fair point. I'm more skeeved out by the repo going up in smoke without warning than where it ended up hosted.

Splinter
Jul 4, 2003
Cowabunga!

Full Circle posted:

Any React devs currently using ant-design might want to start planning an exit strategy. Their GitHub repo was deleted without warning over the weekend, and it is now hosted exclusively on the CCP-funded gitee.

We were very close to using Ant for a new project at work but ultimately ended up going with ElasticUI for various reasons, looks like we may have dodged a bullet (or perhaps Ant would've actually been the prefect choice, as the project's name acronym just happens to be CCP). Also strange that their data visualization libraries (AntV) are still up on GitHub.

e: apparently the Ant D repo was just hacked?

Lord Of Texas
Dec 26, 2006

The functional programming thread is long locked, anyone here have work experience with Elm or Purescript? I've dicked around with Elm in my free time, but haven't used it at work. Transitioning to a new job at a small shop and wondering if it's worth trying to introduce one of them.

barkbell
Apr 14, 2006

woof
Is there a good tool for making sure my html document is in order? I use a combination of google's lighthouse and a front end checklist, but i didnt know if there was something better

e: btw for managing assets i went with cloudinary

Queen Victorian
Feb 21, 2018

You mean like HTML validation?

W3C has a validator: http://validator.w3.org

That’s just the one for HTML. The page links to others.



Question of my own: is there a better way of learning the intricacies of WebPack beyond reading the docs and Googling poo poo? Would taking a course help?

I’m trying to fix a bad and horrible webpack configuration (made by yours truly) because it is slowing me down because it doesn’t do poo poo automatically and I have to manually rebuild and I finally have some time to unfuck it (or do it over).

VagueRant
May 24, 2012
Is there an idiot's guide to AWS? Or a translation for their service descriptions? Scrolling through pages of near identical paragraphs trying to tell an EC2 from a Lightsail and remember what an S3 is and there's a Code Pipeline which is different fron Code Deploy and they've got the absolute worst interface for all of this.

I've never felt worse for DevOps, or for the fact my company has no DevOps people.

barkbell posted:

Is there a good tool for making sure my html document is in order? I use a combination of google's lighthouse and a front end checklist, but i didnt know if there was something better

e: btw for managing assets i went with cloudinary
Would second the w3 validator. It'll even let you know all the unsolveable issues Wordpress gave you!

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



VagueRant posted:

Is there an idiot's guide to AWS? Or a translation for their service descriptions? Scrolling through pages of near identical paragraphs trying to tell an EC2 from a Lightsail and remember what an S3 is and there's a Code Pipeline which is different fron Code Deploy and they've got the absolute worst interface for all of this.

I've never felt worse for DevOps, or for the fact my company has no DevOps people.

Something like https://expeditedsecurity.com/aws-in-plain-english/

marumaru
May 20, 2013




i love this
fire the amazon marketing department

minato
Jun 7, 2004

cutty cain't hang, say 7-up.
Taco Defender

marumaru posted:

i love this
fire the amazon marketing department

What, this guy?



I always laugh out loud when I scroll to the bottom of an AWS blog post, he just looks so goddamn goofy.

putin is a cunt
Apr 5, 2007

BOY DO I SURE ENJOY TRASH. THERE'S NOTHING MORE I LOVE THAN TO SIT DOWN IN FRONT OF THE BIG SCREEN AND EAT A BIIIIG STEAMY BOWL OF SHIT. WARNER BROS CAN COME OVER TO MY HOUSE AND ASSFUCK MY MOM WHILE I WATCH AND I WOULD CERTIFY IT FRESH, NO QUESTION

marumaru posted:

i love this
fire the amazon marketing department

Actually their marketing department is very good and will write reams and reams of information targeted at purse holders to convince them to spend money.

However...

Their developer documentation is poor for beginners, it skips that gap where it's like okay, I want the high level spiel but low level enough to be useful to a dev. Every time I find a new AWS service and want to find more about its applicability to us as a team, I wind up having to look for information on third party sites.

I love AWS don't get me wrong, and their documentation isn't by any stretch "awful" or "poo poo", it just has this gap.

Munkeymon
Aug 14, 2003

Motherfucker's got an
armor-piercing crowbar! Rigoddamndicu𝜆ous.



minato posted:

What, this guy?



I always laugh out loud when I scroll to the bottom of an AWS blog post, he just looks so goddamn goofy.

Looks like Patton Oswalt lost some weight and dyed his hair purple

prom candy
Dec 16, 2005

Only I may dance
I'm glad I went bald so that I could skip having an old man reconnecting to his punk roots by dyeing his hair again phase. There is no way I would have been able to dodge that bullet.

uncle blog
Nov 18, 2012

I prefer to keep a bunch of constants like colors, fonts and what not in its own js file, that I then import the different values from when creating new components. This is super easy when I use styled-components in a js file. But is there an easy way to import them into a scss file?

Queen Victorian
Feb 21, 2018

uncle blog posted:

I prefer to keep a bunch of constants like colors, fonts and what not in its own js file, that I then import the different values from when creating new components. This is super easy when I use styled-components in a js file. But is there an easy way to import them into a scss file?

Just put the constants straight into an scss file and then import that file into the component stylesheets? Are you using straight SASS or a CSS-in-JS solution? If it’s the former I can help (because I write stylesheets and refuse to let JavaScript into yet another place it doesn’t belong, in my opinion).

Buller
Nov 6, 2010
Having major problems with a GML2 WFS call in Openlayers using npm.

Ive tried using this same code with GeoJSON on a different dataset and it just worked. However when I tried with GML I am running into a wall.

Now trying GML2 I get no errors, but it also doesnt seem to be reading much?

var vectorSource = new VectorSource({
format: new GML2(),
url: function (extent) {
return (
'https://arealinformation.miljoeportal.dk/gis/services/DAIdb/MapServer/WFSServer?' +
'request=GetFeature&service=WFS&typename=dmp:BES_NATURTYPER&outputFormat=GML2&' +
'SRsname=EPSG:25832&' +
'bbox=' +
extent.join(',') +
',EPSG:25832'
);
},
strategy: bboxStrategy
});

var vector = new VectorLayer({
source: vectorSource,
style: new Style({
stroke: new Stroke({
color: 'rgba(0, 0, 255, 1.0)',
width: 2,
}),
}),
});


var raster = new TileLayer({
source: new OSM({
url: 'https://{a-c}.tile.openstreetmap.org/{z}/{x}/{y}.png'
}),
});

var map = new Map({
layers: [raster, vector],
target: document.getElementById('map'),
view: new View({
center: [55.5, 11.5],
maxZoom: 19,
zoom: 15,
}),
});


The datasource is from Denmark and when I put the URL into a browser I get a XML document reponse, but I get no features showing up on my map.

This is what the object looks like in console for GML2.

https://imgur.com/vpoVqk4


And this is the error image for GML3 https://imgur.com/M91KGSw

example GML3 URL: https://arealinformation.miljoeport...3886,EPSG:25832
WARNING: 50 MB

the GML3 error seems to be about it being unable to read it? I am setting this up on a localhost so I have no idea if there could be any kind of error due to me not having proper channels or something like that? This is my first ever attempt at setting up WFS features on a webmap.

Chas McGill
Oct 29, 2010

loves Fat Philippe

uncle blog posted:

I prefer to keep a bunch of constants like colors, fonts and what not in its own js file, that I then import the different values from when creating new components. This is super easy when I use styled-components in a js file. But is there an easy way to import them into a scss file?

CSS variables?

Chenghiz
Feb 14, 2007

WHITE WHALE
HOLY GRAIL

Buller posted:

Having major problems with a GML2 WFS call in Openlayers using npm.

Post your code in a GitHub gist or something and I can take a look

Buller
Nov 6, 2010

Chenghiz posted:

Post your code in a GitHub gist or something and I can take a look

https://github.com/Khorstaau/WFShelp

Chenghiz
Feb 14, 2007

WHITE WHALE
HOLY GRAIL

So I had some issues and had to update Parcel, but this displayed a map for me. It's really zoomed in at 0,0 which is ocean so you have to zoom out a ways to see anything. What are you expecting to see?

Buller
Nov 6, 2010

Chenghiz posted:

So I had some issues and had to update Parcel, but this displayed a map for me. It's really zoomed in at 0,0 which is ocean so you have to zoom out a ways to see anything. What are you expecting to see?

I want to get WFS features to show up when Im zooming in on Denmark. As you can see in the new GML2 call. It doesnt give me an error but it also doesnt create features and I dont know why.

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

I am trying to use React as the UI for my game made with PixiJS.

Currently I am using this https://github.com/odrick/webpack-free-tex-packer to create a spritesheet from my images, as part of my webpack build process.

This works fine, I am able to import the spritesheets json file in PixiJS and it finds the image etc.

Basically this webpack plugin puts sheet.json and sheet.png in my assets folder when I build.

My issue is that I want to use the images in the React part as well. This plugin is able to generate a .css file for the spritesheet, which shares the same spritesheet image and would be great to use for the React part.

Problem is that I can't seem to find any way to actually import the generated .css file, since it's created during the build, I am not really sure how I would reference it.

When I use it in PixiJS I just reference it like this
code:
Loader.shared.resources["assets/sprite.json"].spritesheet
I seem to be unable to import it in my .scss files or in a React file.

Lumpy
Apr 26, 2002

La! La! La! Laaaa!



College Slice

Sistergodiva posted:

I am trying to use React as the UI for my game made with PixiJS.

Currently I am using this https://github.com/odrick/webpack-free-tex-packer to create a spritesheet from my images, as part of my webpack build process.

This works fine, I am able to import the spritesheets json file in PixiJS and it finds the image etc.

Basically this webpack plugin puts sheet.json and sheet.png in my assets folder when I build.

My issue is that I want to use the images in the React part as well. This plugin is able to generate a .css file for the spritesheet, which shares the same spritesheet image and would be great to use for the React part.

Problem is that I can't seem to find any way to actually import the generated .css file, since it's created during the build, I am not really sure how I would reference it.

When I use it in PixiJS I just reference it like this
code:
Loader.shared.resources["assets/sprite.json"].spritesheet
I seem to be unable to import it in my .scss files or in a React file.

You probably know this bit already, but to use css in React you generally just do:

JavaScript code:
// MyComponent.jsx
import React from 'react'
import "../path/to/file.css"

const MyComponent = () => <div className="someClassNameInMyFile>lol</div>
Since your CSS is being generated at build time, can you have it generate first, then add a step to copy it somewhere React can see it then? (or just have all your CSS imports point at the file where it's built, knowing it will blow up the first time)

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

Sistergodiva posted:

I am trying to use React as the UI for my game made with PixiJS.

Currently I am using this https://github.com/odrick/webpack-free-tex-packer to create a spritesheet from my images, as part of my webpack build process.

This works fine, I am able to import the spritesheets json file in PixiJS and it finds the image etc.

Basically this webpack plugin puts sheet.json and sheet.png in my assets folder when I build.

My issue is that I want to use the images in the React part as well. This plugin is able to generate a .css file for the spritesheet, which shares the same spritesheet image and would be great to use for the React part.

Problem is that I can't seem to find any way to actually import the generated .css file, since it's created during the build, I am not really sure how I would reference it.

When I use it in PixiJS I just reference it like this
code:
Loader.shared.resources["assets/sprite.json"].spritesheet
I seem to be unable to import it in my .scss files or in a React file.

The difference between Pixi and React is that Pixi is getting the stylesheets at runtime, whereas with React any CSS you import gets integrated at the build so the CSS has to be there then. That said I don't think you have to import the css into React, if you can load the CSS globally then it should (I believe) work on elements built by React... all that React import is doing is obfuscating the CSS a bit to make it unique to that file.

Or get webpack to build that CSS before it runs React. You could split your build into two webpack runs (one to make the CSS, and one to package everything). Alternatively look at your loader order in your config; the loaders are run from last to first, but I don't know whether webpack uses that order to load the files, or if it's run to resolve files that webpack loads in its own order.

Chenghiz
Feb 14, 2007

WHITE WHALE
HOLY GRAIL

dupersaurus posted:

if you can load the CSS globally then it should (I believe) work on elements built by React

This does work and is by far the simplest solution.

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

Thanks! I imported it in the index html and it worked. I tried it before but tried the wrong className it parsed the .png as a new class so I had to add that as well.

dupersaurus
Aug 1, 2012

Futurism was an art movement where dudes were all 'CARS ARE COOL AND THE PAST IS FOR CHUMPS. LET'S DRAW SOME CARS.'

Sistergodiva posted:

Thanks! I imported it in the index html and it worked. I tried it before but tried the wrong className it parsed the .png as a new class so I had to add that as well.

Just be warned that you could be seriously increasing your initial load size, so be careful about that.

Sistergodiva
Jan 3, 2006

I'm like you,
I have no shame.

dupersaurus posted:

Just be warned that you could be seriously increasing your initial load size, so be careful about that.

Yeah. This is a game where I do the ui in react and the actual game in PixiJS. Since there seems to be no decent ui lib for pixi. Instead of sending base64 from the games sprite sheet to the ui, I get it to create the sprite sheet with both a json for pixi and a .css for the react part, using the same png.

So when you pick up an item I can just set the class of a div to the name of the item in the sprite sheet to show the item in the react inventory.

frogbs
May 5, 2004
Well well well
So i'm an old that's probably 10 years behind when it comes to modern web development. I have an idea for a little project that i'm inclined to just build using HTML, CSS and Javascript, but thought maybe there's a reason to use it as an excuse to check out some more modern frameworks/workflows. There's so many places to start it's a little daunting, but maybe someone could recommend something?

I wanted to mock up a page to help you choose a bag for photo gear. Basically the top of the page would have a form where you could enter the height/width/depth of your camera. From this we'd calculate the volume of the camera. The lower part of the page would then load a list of bags that could contain that size camera. The list of bags wouldn't be dynamic or anything, it'd just be a json array or something with a 'volume' attribute, we'd just want to load any bags that were larger than what you list in the form.

It's nothing crazy, so is even trying to use a modern framework overkill? I started looking at next.js, is that a good place to start as any?

The Fool
Oct 16, 2003


I’d probably go with vanilla js for a project like that. But realistically use whatever will make it easier/more fun for you to finish the project.

Adbot
ADBOT LOVES YOU

fsif
Jul 18, 2003

If you want to learn a modern framework it's as good a project as any. That said, not sure Next.js makes a ton of sense for a simple single page app like that.

Do you know React already? Next is really a React framework; would make more sense IMO to focus on learning just React first. Look up the React docs and make a simple app using create-react-app.

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply