3.0.96 • Published 2 days ago

@thinkpixellab-public/px-vue v3.0.96

Weekly downloads
-
License
MIT
Repository
github
Last release
2 days ago

px-vue

General purpose vue components that can be used across projects.

Instructions

There is a basic dev environment in this project that use the VueCLI to serve the contents of dev.vue. This file can be thought of as a scratch file and shouldn't contain anything that needs to be preserved.

Structure

There is no primary entry point into this package so individual components or other files need to be imported directly. The package uses the same project structure as most of our other Vue projects (e.g. components in the /components folder, etc.).

import PxToggle from '@thinkpixellab-public/px-vue/components/PxToggle.vue';

Dependency on px-styles

TLDR;

When you import a component in your Vue project you may also need to include a file at the root of your project called /px-styles.config.scss that configures px-styles. If that file isn't present, many of the components in this package won't build.

The most basic version of this file looks like this:

/*
    px-styles.config.scss
*/

// import the library (so we can configure it)
@use '@thinkpixellab-public/px-styles' as px;

// add configuration as needed (this is optional)
@include px.config('colors:accent', purple);

// initialize
@include px.init();

Longer Explanation

Many of the components require px-styles. To ensure that px-styles has been initialized in the context of the project where the components are being used (e.g. has the correct configuration settings from the project, not arbitrary defaults or configuration set here), the components need to be able to reference a config file from that project.

Here's the werid problem in a nutshell:

  1. SomeProject imports PxToggle.vue from @thinkpixellab\px-vue
  2. PxToggle style section imports px-styles from @thinkpixellab/px-styles
  3. px-styles needs to be configured somehow but that configuration should come from SomeProject and sass is really bad at figuring that out dynamically.

So, the solution becomes:

  1. PxToggle looks for a file called px-styles.scss at the root of SomeProject which it expects to do the job of configuring px-styles.

Because we use a hard coded path to px-styles.scss, that file will get resolved within the project that is importing the component instead the root of this package.

Aliasing a Local Version During Development

To resolve @thinkpixellab-public/px-vue from a local folder during development, you can extend webpack as follows

const path = require('path');

// add to webpack config
{
    resolve: {
        alias: {
            '@thinkpixellab-public/px-vue': path.resolve(__dirname, '../px-vue'),
        },
    }
}

Note that if using vue-cli you need to add the above to a file called vue.config.js in the project root that looks like this:

module.exports = {
    configureWebpack: {
        // add the config from above
    },
};
3.0.96

2 days ago

3.0.95

9 days ago

3.0.94

10 days ago

3.0.93

15 days ago

3.0.92

16 days ago

3.0.91

28 days ago

3.0.90

1 month ago

4.0.10

1 month ago

3.0.89

2 months ago

3.0.88

2 months ago

3.0.87

3 months ago

3.0.86

3 months ago

3.0.85

3 months ago

3.0.83

3 months ago

3.0.84

3 months ago

3.0.82

4 months ago

3.0.81

5 months ago

3.0.80

5 months ago

3.0.79

5 months ago

3.0.78

5 months ago

3.0.77

5 months ago

3.0.76

5 months ago

3.0.56

9 months ago

3.0.57

9 months ago

3.0.54

10 months ago

3.0.55

10 months ago

3.0.58

9 months ago

3.0.59

9 months ago

3.0.53

10 months ago

3.0.67

8 months ago

3.0.68

7 months ago

3.0.65

8 months ago

3.0.66

8 months ago

3.0.69

7 months ago

3.0.60

9 months ago

3.0.63

8 months ago

3.0.64

8 months ago

3.0.61

8 months ago

3.0.62

8 months ago

3.0.70

6 months ago

3.0.71

6 months ago

3.0.74

6 months ago

3.0.75

6 months ago

3.0.72

6 months ago

3.0.73

6 months ago

3.0.51

10 months ago

3.0.50

11 months ago

4.0.5

11 months ago

4.0.4

11 months ago

4.0.7

11 months ago

4.0.6

11 months ago

4.0.3

11 months ago

4.0.9

11 months ago

4.0.8

11 months ago

3.0.45

11 months ago

3.0.46

11 months ago

3.0.43

12 months ago

3.0.44

11 months ago

3.0.49

11 months ago

3.0.47

11 months ago

3.0.48

11 months ago

4.0.1

11 months ago

4.0.0

12 months ago

4.0.2

11 months ago

3.0.41

1 year ago

3.0.42

1 year ago

3.0.40

1 year ago

3.0.39

1 year ago

3.0.38

1 year ago

3.0.36

1 year ago

3.0.37

1 year ago

3.0.34

1 year ago

3.0.35

1 year ago

3.0.32

1 year ago

3.0.33

1 year ago

3.0.27

1 year ago

3.0.28

1 year ago

3.0.26

1 year ago

3.0.30

1 year ago

3.0.31

1 year ago

3.0.29

1 year ago

3.0.23

1 year ago

3.0.24

1 year ago

3.0.21

1 year ago

3.0.22

1 year ago

3.0.25

1 year ago

3.0.20

1 year ago

3.0.18

1 year ago

3.0.19

1 year ago

3.0.12

2 years ago

3.0.13

2 years ago

3.0.11

2 years ago

3.0.16

2 years ago

3.0.17

1 year ago

3.0.14

2 years ago

3.0.15

2 years ago

3.0.10

2 years ago

3.0.9

2 years ago

3.0.8

2 years ago

3.0.7

2 years ago

3.0.6

2 years ago

3.0.5

2 years ago

3.0.4

2 years ago

3.0.3

2 years ago

3.0.2

2 years ago

3.0.1

2 years ago