-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Documentation] Recommended build process messy #3767
Comments
Simple example with yarn
Note: If you won't bundle UIkit's code with your own custom code, don't install UIkit with yarn or npm. Simply use the CDN version or download it directly from Github. |
@aarongerig Thank you for your reply. Very helpful, I was wondering if you have any example of 4 - 5, I like the idea of using UIKit as a module and extending it from inside my folder structure. I use Gulp so I'm not entirely sure how to include it into my build process. Especially when it comes to JavaScript. I know I can import the less file, but the JavaScript I'm a little loss to. I'm guessing Gulp wouldn't work in this aspect because it's more of a post-processor than a package manager? If I could run yarn install to compile to /assets as you said, which will also include any variable modifications or hooks that seems really clean. |
Of course this works with gulp as well and yes, I would recommend to use webpack. Once you have some spare time, have a look at it. ;) Simple gulp setup
var gulp = require('gulp');
var less = require('gulp-less');
var babel = require('gulp-babel');
gulp.task('styles', function() {
return gulp.src('./assets/src/less/main.less')
.pipe(less({
paths: ['./node_modules/uikit/src/less']
}))
.pipe(gulp.dest('./assets/dist/css/'));
});
gulp.task('scripts', function() {
return gulp.src([
'./node_modules/babel-polyfill/dist/polyfill.js',
'./assets/src/js/main.js'
])
.pipe(babel({ presets: ['es2015'] }))
.pipe(gulp.dest('./assets/dist/js'))
});
// maybe some other tasks ...
assets/src/less/main.less // Core
@import 'uikit.less';
// Customize your theme here ... assets/src/js/main.js import UIkit from 'uikit';
import Icons from 'uikit/dist/js/uikit-icons';
// loads the Icon plugin
UIkit.use(Icons);
// components can be called from the imported UIkit reference
UIkit.notification('Hello world.'); Note: This is completely untested and may contain errors. I'm closing this, since this has nothing to do with UIkit anymore. |
This may sound like a dumb question, but how do you see run it after I have ran all the commands from the uikit site: https://getuikit.com/docs/installation but after
|
I'm a little confused by the recommended way of getting UIKit in to a project. The recommended way is to use YARN. So the root of the project will have UIKit installed under ./node_modules/uikit/. If we were to customise the theme in which most people will want, we do Yarn Install which adds another node_modules. So we have /node_modules/uikit/node_modules/ this is starting to get really messy.
I feel like more can be done to streamline this. Especially since the path to UIKit to include into a project becomes ./node_modules/uikit/dist/css/uikit.min.css and ./node_modules/uikit/dist/js/uikit.min.js personally I don't think that feels really clean, especially since you wouldn't want node_modules included in a repository so the .gitignore becomes difficult because you want to stop one node_modules but not the other.
I feel like the recommended way should be to clone uikit github and yarn from there. Giving a much nicer folder structure so the path is simply uikit/dist/css/uikit.min.css and we can ignore node_modules from the repository.
The text was updated successfully, but these errors were encountered: