Code Monkey home page Code Monkey logo

one-loader's People

Contributors

dependabot[bot] avatar mungell avatar simplycomplexable avatar theknarf avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

one-loader's Issues

Rewrite to remove lodash.get and lodash.set

This is currently the only place those two dependencies are used. It shouldn't be too much work to rewrite that bit to not use it. That would make it so that one-loader has almost no external dependencies.

options.map

In the example you set options.map to the following:

options: {
   map: {
      'text/css': ['style-loader', 'css-loader'],
      'javascript': 'babel-loader'
   }
}

But this seem a bit odd to me, given that the sections are called style and `script, wouldn't this make more sense:

options: {
   map: {
      'style': ['style-loader', 'css-loader'],
      'script': 'babel-loader'
   }
}

Especially in regards to #44 if we want to add more types of sections. It seems that the map-option should be named the same as sections.

one-loader and gatsby

Gatsby (and probably also next.js) abstract the webpack configuration away, and therefore make normal webpack configuration as documented in the one-loader readme.

Gatsby provides hooks to append the webpack config, but in their documentation says, you should avoid editing the webpack config and always check for an existing gatsby module first.

I've got it working with the config below, but it might be worth creating a one-loader gatsby plugin.

// gatsby-node.js

module.exports = {
	onCreateWebpackConfig: ({stage, rules, loaders, plugins, actions}) => {
		actions.setWebpackConfig({
			module: {
				rules: [
					{
						test: /\.one$/,
						use: [
							{
								loader: 'one-loader',
								options: {
									map: {
										'text/css': rules.css().use,
										'text/scss': [...rules.css().use, 'sass-loader'],
										'javascript': rules.js().use,
									}
								}
							},
						],
					},
					{
						test: /\.scss$/,
						use: [...rules.css().use, 'sass-loader'],
					},
				],
			},
		})
	},
	resolvableExtensions: () => {
		return [`.one`];
	}
}

So, should we (and is someone willing to), create a gatsby plugin?
Or should we create some documentation here to show people how to get it working manually?

Without ejecting?

I really like the concept of this project, but it seems that I need to eject from create-react-app.

Any chance to have a custom script like TypeScript's or Kitze's?

Feature: Option to pass blocks to loaders defined in Webpack config?

Hi. Thanks for this, I was writing a loader to do this and researching when I discovered it.

One thing I would like would be an option to pass a block to loaders defined in config. Vue-Loader was recently updated to work that way, but I haven't looked at how they do it. Maybe by enabling a "useConfig" option, the loader could add each block as a dependency or figure out a way to load the one file as other types with an inline option to only load a certain block (or filter out other). The type specified like <style lang="sass">. I'm wondering how difficult it would be to implement something like this so people could easily use existing configs and the same config used for .one files would be used for import statements in files.

I'm sure this could be done from config side by storing each config in a var, too, just wondering if it could be integrated. Thanks.

Production ready?

First off, thanks so much for making this.

I love vue's single file components, it just makes sense. I'm brand new to React, and after some googling, it turns out that React recommends CSS in JS, which makes me want to puke. Not only are we going back to inline styles, but I'd have to put styling right next to component logic, camel case everything, etc.

/rant

Anyways, how do you feel about using this in production? Is it stable?

Side note: Vue-loader allows you to inject a scss file into every <style></style>, so you don't have to import variables, mixins, functions, etc into every component. Does your package allow this?

one-loader really react specific?

The readme says that one-loader is A webpack loader to enable single-file React components. Inspired by vue-loader..

But is it really react specific? And why don't we want to market it as a general purpose single file component loader?

TypeScript

How to I set this up to work with TypeScript?

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.